如何在提交时创建新的头?
我正在写我的论文并将更改存储在 Mercurial 中。我没有收到“我有多个头”的错误,对此我感到很困惑——我只有一个工作存储库,我偶尔会将其推送到 bitbucket。发生的事情是这样的:
$ hg commit -m "Fixing up..."
abort: No such file or directory: /Users/me/Dropbox/thesis/thesis_tex/simple.pdf
$ hg commit -m "Adding in page headers"
created new head
...再次提交,没有意识到创建一个新头是一个问题...
$ hg push
pushing to ssh://[email protected]/...
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)
$ hg heads
changeset: 26:3823a395b1ce
tag: tip
user: me
date: Fri Aug 26 09:39:45 2011 -0400
summary: Adding...
changeset: 24:c7c6517d4281
user: me
date: Thu Aug 25 16:34:42 2011 -0400
summary: Fixing up...
我怎样才能轻松地摆脱另一个头,而不弄乱我的工作目录?为什么要创造第二个头?将 Mercurial 存储库保存在 dropbox 文件夹中是否存在问题?
I'm working on my thesis and storing changes in mercurial. I'm not getting an error that I've got multiple heads, which I'm confused about -- I've only got one working repository which I push occasionally to bitbucket. Here's what happened:
$ hg commit -m "Fixing up..."
abort: No such file or directory: /Users/me/Dropbox/thesis/thesis_tex/simple.pdf
$ hg commit -m "Adding in page headers"
created new head
...one more commit, not having realized that having created a new head was a problem...
$ hg push
pushing to ssh://[email protected]/...
searching for changes
abort: push creates new remote heads!
(did you forget to merge? use push -f to force)
$ hg heads
changeset: 26:3823a395b1ce
tag: tip
user: me
date: Fri Aug 26 09:39:45 2011 -0400
summary: Adding...
changeset: 24:c7c6517d4281
user: me
date: Thu Aug 25 16:34:42 2011 -0400
summary: Fixing up...
How can I easily get rid of the other head, without messing up my working directory? Why did a second head get created? Is there a problem with keeping mercurial repositories in dropbox folders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
hg merge
合并分支。这对我来说似乎多余,因为 Dropbox 会保留您的文件 30 天的历史记录。我会选择 Hg+Bitbucket(或任何 Mercurial 托管)或 Dropbox,但不能同时选择两者。
编辑:为什么不使用 Mercurial 和 Dropbox? 原因如下。
Ben Hughes 说得好:
Merge the branches with
hg merge
.This seems redundant to me, since Dropbox keeps a 30-day history on your files. I'd choose either Hg+Bitbucket (or whatever Mercurial hosting) or Dropbox, but not both.
Edit: Why not use Mercurial and Dropbox? Here's why.
Ben Hughes said it well:
我不同意@Matt Ball 关于保管箱问题的观点。
我认为冗余是你的朋友。此外,Hg 和保管箱的用途在您的情况下也略有不同。
Dropbox 会自动为您备份(还可以跟踪文件更改,让您在任何有互联网的计算机上工作,并轻松共享您的工作。),Hg 可以让您离线工作并按逻辑块提交(以及作为备份)当您同步时)。
我在我的保管箱文件夹中使用 Hg 至少有一年了,没有出现任何问题,而且没有遇到任何问题。
如果您在多台计算机上工作并且所有计算机上都有 dropbox/Hg 组合,我建议您让 dropbox 进行同步。
I disagree with @Matt Ball on the dropbox matter.
I think redundancy is your friend. Also the purpose of Hg and the dropbox is slightly different in your case.
Dropbox backs up for you automatically (as well as tracking file changes and letting you work on any machine with internet and making it easy to share your work.) and Hg lets you work offline and commit in logical chunks (as well as working as backup when you sync).
I have used Hg in my dropbox folder without problem for at least a year and I have not experienced any problems.
If you work on more than one machine and have the dropbox/Hg combo on all machines I suggest that you let dropbox do the syncing.