3 ms·
Strictly speaking, you can pull from any remote branch directly: git fetch remotename git merge remotename/master But you usually just want to rebase
by itafroma 13y ago
Strictly speaking, you can pull from any remote branch directly:
git fetch remotename
git merge remotename/master
But you usually just want to rebase your changes onto the latest HEAD:
git fetch remotename
git rebase remotename/master
Merging will place the remote branch's changes after yours, which will make your history a nightmare, especially if you're going to continue working on your branch. Rebasing will place your local branch changes after the latest changes to the main branch.
- kyleslattery 13y agoYou can even collapse the first one into a single command: "git pull remotename master"
- raimondious 13y agoAnd the second one too: "git pull --rebase remotename master"
- _ikke_ 13y agoNote that in this case, your remote tracking branches wont be updated, so git status will say you are ahead of the remote, while you are in fact at the same point. A "git fetch <remote>" would then update the remote tracking branches.