5

I have a two remote branches: origin/master and origin/my_remote_feature

I have checked out my_remote_feature using git checkout --track -b origin/my_remote_feature

There are a couple of changes made in master that I want to pull into my branch that tracks the remote branch. How do I go about it ?

1

3 Answers 3

8
git rebase origin/master 

Is all you really need to do. then resolve any conflicts. You might need

git rebase --continue 

if there are are conflicts. This will put my_remote_feature commits on top of the HEAD of origin/master. Re-writing history as it were.

git merge origin/master 

Is also a possibility. However, you will find that all the commits to master will become part of your remote_feature commit history. Which you may not want. Generally rebase is better to keep your commit history pristine. :)

Sign up to request clarification or add additional context in comments.

Comments

2

One cool way to do this is to rebase origin/master into your remote branch. You can follow the following rebase workflow;

  1. Check out to your local my_remote_feature branch and pull changes from that branch. git pull origin my_remote_feature

  2. Do a git fetch

  3. Then rebase origin/master like git rebase origin/master

  4. If all works successfully, push your new updates. git push origin my_remote_feature

This will bring all the changes on master on top of your changes in my_remote_feature. If there are any conflicts, you will have to resolve them along the way and make sure you add files after resolving conflicts then do a git rebase --continue after every conflict resolutions.

You can refer to the git rabase doc for more information.

Comments

1

Merge the master branch to your feature branch and then push the changes.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.