I’ve set up tracking branches with the
--track option, and when I do a
git pull on
master, it fetches all branches to
origin/branchname but doesn’t merge with the local tracking branches. This is extra annoying, because if I later do a
git push on
master, it says that non-fast-forward updates were rejected on the tracking branches, since they weren’t fast-forwarded on the initial
My question is: How do I make it so that
git pull with fetch all branches and automatically fast-forward all the tracking branches?
git pull used to fast-forward all my tracking branches with my GitHub repos, but now that I’ve set up my own repos using Gitolite, this problem is cropping up.
- Git won’t merge (the second step of
git pullafter the
fetchpart) files unless the branch is checked out first. See "Can “
git pull --all” update all my local branches?"
masterwill merge files on
master, meaning the next push will be a fast-forward one. A non fast-forward can only occur if a push to the remote
masterfrom another repo has been done prior to your push.
Note: I suppose you have tracked all your remote branches as in "Track all remote git branches as local branches."
Note: Git 2.0 (Q2 2014) will introduce with commit b814da8 a config
By default, Git does not create an extra merge commit when merging a commit that is a descendant of the current commit. Instead, the tip of the current branch is fast-forwarded.
- When set to
false, this variable tells Git to create an extra merge commit in such a case (equivalent to giving the
--no-ffoption from the command line).
- When set to
only, only such fast-forward merges are allowed (equivalent to giving the
--ff-onlyoption from the command line).
Answered By – VonC