Git - Automatically fast forward all tracking branches on pull

后端 未结 6 1733
闹比i
闹比i 2020-12-28 12:32

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/br

6条回答
  •  执念已碎
    2020-12-28 13:23

    But wait:

    • git won't merge (the second step of git pull after the fetch part) files unless the branch is checked out first. See "Can “git pull --all” update all my local branches?"
    • git pull on master will 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 master from 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 push.ff:

    pull.ff::
    

    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-ff option from the command line).
    • When set to only, only such fast-forward merges are allowed (equivalent to giving the --ff-only option from the command line).

提交回复
热议问题