Put current changes in a new Git branch [duplicate]

落花浮王杯 提交于 2021-02-17 07:27:26

问题


I've been editing some modules on the master branch but I haven't committed them. I'm now thinking that these changes should really be on an experimental branch and not the master branch.

How can I get these edits into an experimental branch? Copy them to some temp location, create the branch, and then copy them back in?

And how do I configure things so that when I do a git push from the new experimental branch it will it go into a branch of the same name in my GitHub repo?


回答1:


You can simply check out a new branch, and then commit:

git checkout -b my_new_branch
git commit

Checking out the new branch will not discard your changes.



来源:https://stackoverflow.com/questions/4746672/put-current-changes-in-a-new-git-branch

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