如何将所有修改移至分支
我在 HG 中创建了一个工作存储库。 而且我修改了一些文件。
如何将所有修改移至分支(我尚未创建的分支)? (类似于“git stash”,并将存储的内容移至分支。实际上,我也不知道如何在 git 中做到这一点。如果你知道,如果你也能在 git 中告诉我,我将不胜感激)
谢谢你。
I create a working repository in HG.
And I have modified some files.
How can i move my all my modification to a branch (a branch that I have not created)?
(kind of 'git stash' and the move the stash away change to a branch. Actually, I am not sure how I can do that in git either. If you know, I appreciate if you can tell me in git as well)
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于 Git,如果您尚未提交文件,只需键入:
此时暂存的每个文件都将在新分支中提交。
对于 Mercurial,默认情况下分支不是名称,并且仅当提交的父级已有子提交时才会出现新分支(在一个存储库内):
但您可以创建一个新的分支名称对于您的下一次提交:(
另请参阅 指南Mercurial 中的分支,以及 Git 和 Mercurial 模型)
For Git, if you have not yet committed your files, just type:
Every file staged at this point will be committed in the new branch.
For Mercurial, branches are not names by default, and a new branch only occurs (within one repo) if a commit has a parent which has already a child commit:
But you can create a new branch name for your next commit:
(See also a Guide to branching in Mercurial, and Git & Mercurial models)
首先检查以确保 ShelveExtension 和 AtticExtension 完全按照您的意愿行事。
如果您在 Mercurial 中手动执行此操作,我会避免使用命名分支,而只使用另一个头。例如,如果您已经做出了想要“暂时搁置”的更改。
现在就开始在那里工作吧。您可以稍后使用
hg Heads
找到该匿名分支,并使用hg merge
将其合并。First check to make sure that neither the ShelveExtension nor AtticExtension do exactly what you want.
If you're doing it manually in mercurial I'd avoid a named branch, and just use another head. If for example, you already made the changes you want to "put away" for a little bit.
and now just start working there. You can find that anonymous branch later with
hg heads
and merge it in withhg merge
.