Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on

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

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

Avatar of undefined
Last Comment
Bruce Gust

8/22/2022 - Mon
Chris Stanyon

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 Gust

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? 
Chris Stanyon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Bruce Gust

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck