I just realized that my coworker has merged my feature branch into the master branch in Github, while I have been continuing working on my feature branch on my local machine
I am not confident with rebase or git in general yet.
Remember, you can always just make a copy of your repository and try things out there without worrying about mucking things up. In fact, if you are running commands you're not familiar with recommended by people you don't know, this is probably a good idea in general.
Could you give specific commands for me to try?
First, make sure you have an up-to-date copy of the remote repository:
git remote update
Next, make sure you are on your feature branch:
git checkout myfeature
And finally, rebase
onto the updated master
branch:
git rebase origin/master
Depending on the changes in master
since you created your feature branch you may need to perform some conflict resolution. If the only changes was that your feature branch was merged, you shouldn't have to correct anything.
(Note that the above assumes you are working with a remote named origin
, which is common but not guaranteed.)
You can git stash
those changes while you create a new branch. git checkout <<master branch name>>
then git checkout -b <<new topic branch name>>
.
You've got a clean copy of master now, so let's get those stashed changes with git stash pop
. Now you're back to where you started, with all your already committed changes in the trunk and your new changes ready for commit.