How to change the starting point of a branch?

前端 未结 3 1389
-上瘾入骨i
-上瘾入骨i 2021-02-01 19:13

Usually I create a branch by running a command like git checkout -b [branch-name] [starting-branch]. In one case, I forgot to include the starting-branch

3条回答
  •  走了就别回头了
    2021-02-01 19:38

    If you don't have commits in the new branch, using a 'git reset --hard' is the easier.

    If you have commits in the new branch...

    If your branch start on an older commit that you want to, just do a 'git rebase'.

    If, more unlikely, your branch start on a newer commit or on a completely different branch, use a 'git rebase --onto'

提交回复
热议问题