将当前更改放入新的Git分支中 [英] Put current changes in a new Git branch

查看:48
本文介绍了将当前更改放入新的Git分支中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在master分支上编辑一些模块,但尚未提交.我现在认为这些更改实际上应该在实验分支上,而不是在主分支上.

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?

我该如何配置东西,以便当我从新的实验分支进行git push时,它将进入我的GitHub存储库中的同名分支?

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.

这篇关于将当前更改放入新的Git分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆