开发者

Put current changes in a new Git branch [duplicate]

This question already has answers here: Move existing, uncommitted work to a new branch in Git (13 answers) Closed 9 years ago.

I've been editing some m开发者_开发技巧odules 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜