当您的工作副本发生更改时进行 hg update 是一个坏主意吗?
看起来如果你先提交然后合并会更好。我有点惊讶的是,当您的工作副本发生更改时,甚至允许更新。在这种情况下允许更新是否可以避免由合并产生的具有两个父项的提交?
Seems like it would be better if you did commit followed by merge. I'm a little surprised update'ing is even allowed when your working copy has changes. Is allowing updates in such cases to avoid having commits that have two parents, which result from a merge?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信
hg update
会尝试合并您未提交的更改:这将避免对仅更新工作目录的操作(hg update)进行不必要的提交(在
.hg
存储库中注册)。I believe
hg update
will try to merge your uncommitted changes:That will avoid an unnecessary commit (registered in the
.hg
repo) for an operation (hg update) which only is about updating your working directory.Mercurial 鼓励记录项目的所有历史记录。如果您已经在工作目录中完成了一些工作,为什么不提交这些更改,提供对结果的有意义的描述作为提交消息,然后将结果合并到主分支中?其他人会更清楚地在两个单独的变更集中看到您为正常工作所做的工作以及您为解决合并冲突所做的工作。
通常,额外的合并更改集是可以的,但有时您只想在提交之前在主分支之上重新调整当前更改的基础。您可以查看rebase扩展。新的
hg rebase
命令允许您对已提交的更改进行变基。Mercurial encourages recording all the history of a project. If you've done some work in your working directory, why not to commit these changes providing a meaningful description of your results as a commit message and then merge your results into the main branch? It will be more clear for other people to see in two separate changesets what you have made as your normal work and what you have made just for resolving merge conflicts.
Usually an extra merge changeset is OK, but sometimes you just want to rebase your current changes on top of the main branch before committing them. You might take a look at the rebase extension. The new
hg rebase
command allows you to rebase already committed changeses.