忘记建分支无法转换分支_忘记创建新分支。如何将更改转移到新分支

this happens to every developer time-to-time. You start coding a new feature and forget to branch first locally.

So if that happens is there a way I can say hey, transfer these uncommitted (or committed - yea I know those are both two scenarios which I'd like to cover with this) to a new branch for me locally so I don't have to back them out and copy my changes to a new branch to be able to carry on my way?

解决方案

If you haven't commited your changes yet, you can switch to a new branch prior to committing.

git checkout -b my-new-branch

This will create a new branch called my-new-branch and immediately check it out.


版权声明:本文为weixin_30046591原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。