We help IT Professionals succeed at work.

Is this the right sequence of Git commands for this scenario?

Bruce Gust
Bruce Gust asked
on
77 Views
Last Modified: 2020-04-24
So, here's what's going on. How do you utilize Git in this scenario in a way where I'm being smart in preserving my work, while at the same time moving forward.

I push "final-activity-stream" up to Github
I do a pull request
the base branch has been updated
my team lead has made some edits to my code
he recommends a rebase

So, here's what I'm thinking as far as what I'm going to do "Git-wise." Tell me if this is on point...

'code-cleanup" is the base branch. I'm going to check that out locally and do a "pull" so everything is up to date
checkout "final-activity-stream," and create another branch off of it, just so I've got a copy of the work that's been done thus far
go back to "final-activity-stream" and do a pull so I've got all of the edits and changes my team lead has done
do a rebase, which means I'm resetting the base branch of "final-activity-stream" to the newest and coolest version of "code-cleanup." To do that, I'm going to "git rebase code-cleanup."

How's that sound?


First of all, I'm going to do a "pull" create another branch off of my local "final-activity-stream," just so I've got a copy of what I've done so far
Next, I'm going back to my lo
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019

Commented:
Hey Bruce,

Seems like your question ended abruptly, so not sure what else you're asking.

Generally, you're on the right track. If code-cleanup has moved on since you branched (additional commits), and you need those changes in your final-activity-stream, then you can do a rebase - this will change the base commit that your final-activity-stream has branched from.
Bruce GustPHP Developer

Author

Commented:
Good grief...!

That's what happens when the wind is out of your sails and you're still trying to function.

Here's the full sequence I was planning:

1) First of all, I'm going to create another branch off of my local "final-activity-stream," just so I've got a copy of what I've done so far
2) Then I'm going back to my local "final-activity-stream" and do a pull, so I've got my work plus my supervisor's edits
3) Next, check out "code-cleanup" and do a pull, so I've got the best and the brightest on what is my base branch
4) Finally, go out to "final-activity-stream" - what is now updated according to my supervisor's edits - and do a rebase

That's the plan. Is that what somebody would do if they're using Git correctly? 
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Bruce GustPHP Developer

Author

Commented:
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.