Move branch to another branch

前端 未结 3 1044
甜味超标
甜味超标 2021-01-31 08:44

I have started doing some work on a branch which I have in term realised was the wrong branch. Is there a way to move a branch to a different branch.

For example:

<
3条回答
  •  隐瞒了意图╮
    2021-01-31 09:13

    Let's say you've named your branches like so:

        A -- B -- C -- D (master)
         \-- E -- G -- H -- I -- J (current-parent)
              \-- K -- L (my-branch)
    

    What you want to do is rebase my-branch onto the B commit like so:

        git rebase current-parent my-branch --onto B
    

提交回复
热议问题