How to make Git pull use rebase by default for all my repositories?

前端 未结 5 1613
礼貌的吻别
礼貌的吻别 2020-11-28 17:19

Is there a way to setup the host Git repository such that any git pull done from its (local) clones uses --rebase by default? By searching on Stack

5条回答
  •  天命终不由人
    2020-11-28 18:23

    This makes the --rebase option the default when issuing a git pull on a given branch.

    @Flimm, I needed to add true to make your first option work.

    So the correct syntax is:

    git config branch..rebase true
    

    To run this command on the develop branch:

    git config branch.develop.rebase true
    

    And now the develop section in .git/config looks like this:

    [branch "develop"]
            remote = origin
            merge = refs/heads/develop
            rebase = true
    

提交回复
热议问题