Git:自上次提交到新分支后如何移动更改

我一直在研究一个我们可以称之为“A”的分支。 我刚刚意识到自从我上次提交以来我添加的代码应该位于特定的(实验性)分支中,而不是“A”中。 我如何将更改提交到新分支并将分支“A”留在上次提交时的状态?


如果更改已进行或您的工作目录,您可以简单地签出一个新的分支,如下所示:

git checkout -b branch_name

然后您可以直接提交到新分支。


git stash
git checkout branch-A
git stash pop
链接地址: http://www.djcxy.com/p/25261.html

上一篇: Git: Howto move changes since last commit to a new branch

下一篇: move pushed commits to a new branch (rename branch instead of force pushing?)