Reputation: 13548
I'm working on a separate branch from the master branch, and I wondering what will happen if I pull the latest changes from Github. Should I pull from the master branch or the side branch? If I pull from the side branch, will it just merge the updates with my new code in the side branch?
Upvotes: 0
Views: 3912
Reputation: 239311
You want to
origin/master
origin/master
into your local master
branchmaster
branch into your feature branchIf your master hasn't changed you should:
git checkout master
git pull # fetches (step 1) and merges (step 2)
git checkout <my branch>
git merge master # (step 3)
If your local master has changed, git pull
may cause merge conflicts that you will have to resolve. If you want to keep your history clean, you might consider git pull --rebase
and/or rebasing your feature branch onto the newly merged master once steps 1 and 2 are complete.
Upvotes: 4
Reputation: 90316
If you pull from a local branch, you have to specify what remote branch you want to pull from. So if you specify that you want to pull from the master
remote branch, changes that happened on it will get merged in your local branch:
git pull <github-repo-url> master
Then to update your local master branch, check it out and run the same.
Upvotes: 0