How to get latest changes from master branch into feature branch?

3588 views git

I was working on a feature branch and then I found a codegap which needs to filled in by other developer.
If his changes has been merged in master, how can I get those changes in my branch, keeping in mind I haven't committed any changes in my new branch nor pushed my branch to server.

Do I need to rebase ?

answered question

1 Answer


If you can, you could rebase your feature branch on top of master: your feature branch would then include that commit in its ancestors. *I would recommand committing your work in progress on that branch first.

git checkout feature
git rebase master

But it could also include other commits you might not want in your feature branch.
If that is the case, then a workaround would be to use git cherry-pick, to import a specific commit into your feature branch.

posted this

Have an answer?


Please login first before posting an answer.