我如何开始使用 Mercurial?
我有一个关于 Mercurial 的新手问题。
我和一个朋友刚刚开始合作一个项目。我们使用BitBucket。
但是我们如何才能很好的使用mercurial和BitBucket呢?我的意思是,如果我编辑一个文件而我的朋友编辑同一个文件呢?每次提交后,我们如何更新本地工作存储库?
I've a newbie question about Mercurial.
Me and a friend just started to work together to a project. We use BitBucket.
But how can we use mercurial and BitBucket in a good way? I mean, if I edit a file and my friend edit the same file? After every commit how can we update our local working repo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该能够将远程更改拉入本地存储库。请参阅将更改拉入 Bitbucket 存储库作为您实际如何执行此操作的起点。
You should be able to just pull remote changes into your local repository. See Pulling Changes into a Bitbucket Repository as a starting point for how you would actually do this.
您的本地工作存储库会在每次提交后更新。
如果您希望反映本地工作存储库中的(一组)更改
在中央或主存储库中,您应该使用 hg Push
当您想从主存储库中获取朋友的更新时,您应该使用 hg pull。
可能的过程应该是:
在本地工作之前
在本地进行更改之后
当您确定希望其他人看到您的更改时
Your local working repo is updated after each commit.
If you want the (set of) changes in your local working repo to be reflected
in the central or master repo, you should use hg push
When you want to get the updates of your friend from the master repo, you should use hg pull.
A probable course whould be:
before you work locally
after you have made changes locally
when you are sure you want others to see your changes
您将能够克隆存储库,在本地工作,然后合并回存储库。但是,您应该遵循以下操作过程才能成功:
在开始任何新操作之前:
在一个命令中执行拉取和更新操作。
做好你的工作:
如果你现在想将更改推送到远程存储库,则需要首先检查是否有任何传入更改:
这将为您提供有关传入提交的一些信息,但不会拉取任何内容。
这将拉取更改并将您的提交与刚刚拉下的提交合并。由于这是另一个更改(合并操作),因此您需要另一个更改:
最后,推送会将更改推送到远程存储库。
我确实建议阅读 Hg Book,它将深入探讨有关指定要合并的修订的更复杂的主题(例如使用 hg merge -r12345 )。
You are going to be able to each clone the repository, work locally, and merge back in. However, you should follow this course of action to have success:
Before starting anything new:
That does a pull and an update operation in one command.
Do your work:
If you now want to push your changes to the remote repo, you need to check first if there are any incoming changes:
This will give you some information on incoming commits, but won't pull anything down.
This will pull the changes and merge your commits with the commits just pulled down. Since this is yet another change (the merge operation), you need another:
Lastly, the push will push the changes to the remote repo.
I do recommend reading the Hg Book, which will delve into more complex topics on specifying revisions to merge with (using
hg merge -r12345
for example).