Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update a git branch to match master?

Tags:

git

Here's my problem. I have a branch off master, and i made some changes. A little later my partner reverted a change they had made because it was breaking something. When i ran git fetch; git rebase mastermaster was fixed and everything was okay. But when I ran git fetch; git rebase my_feature the my_feature branch still had the same problems as before. How can i update the my_feature branch so that it takes into account the reverted commit? Thanks!

like image 518
cb23er4 Avatar asked Jun 03 '13 05:06

cb23er4


1 Answers

You first need to git fetch and git merge your master branch that is following the remote master branch. You can do this with git checkout master then git pull origin master. This will bring your master branch up to a place that is equilivant with the remote repository.

Then you will need to do the following to rebase your feature branch ontop of the new commits (a git revert is just another commit to a branch and should be treated the same as any other commit (with special concerns depending on the situation)): git checkout my_feature then git rebase master.

This will rebase your feature branch ontop of the new local master branch which should be tracking the remote master branch.

like image 102
g19fanatic Avatar answered Oct 08 '22 03:10

g19fanatic