Git: Can I commit my working directory to a new branch without committing it to a current branch?

六月ゝ 毕业季﹏ 提交于 2019-11-30 11:17:52

Yes, just create the new branch and check it out:

$ git checkout -b new-branch

Then commit any changes you have. They'll be applied to the new, checked-out branch.

You can stash your current changes (git stash), switch to the new branch and then apply the changes to the new branch using

git stash pop
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!