Git: rebase onto development branch from upstream

前端 未结 3 939
日久生厌
日久生厌 2021-02-05 22:08

I have local master and develop branches. I do all my work on develop and then merge them into master for releases. There is

3条回答
  •  自闭症患者
    2021-02-05 22:35

    The command you are looking for is:

    git checkout develop
    git rebase upstream/master
    

    However, Git is smarter than that, you can configure upstream/master as the upstream tracking branch of develop:

    git branch --set-upstream-to upstream/master develop
    

    Now when you do git rebase, it would automatically use 'upstream/master'. But even better, these commands:

    git fetch origin
    git rebase upstream/master
    

    Can be simplified by simply doing:

    git pull --rebase
    

提交回复
热议问题