Moving uncommitted changes to a new branch

Possible Duplicate:
Move existing, uncommited work to a new branch in Git

I have some code in branch ABC.

After making some changes to it, i'd like to move all those uncommitted changes into a commit on a new branch ABC_1.

How can this be done please?


Just create a new branch:

git checkout -b newBranch

And if you do git status you'll see that the state of the code hasn't changed and you can commit it to the new branch.


Just move to the new branch. The uncommited changes get carried over.

git checkout -b ABC_1

git commit -m <message>


Just create a new branch with git checkout -b ABC_1 ; your uncommitted changes will be kept, and you then commit them to that branch.

链接地址: http://www.djcxy.com/p/23580.html

上一篇: 忘了在git中分支,需要从主服务器移动更改

下一篇: 将未提交的更改移至新分支