开发者

Merging from another clone with my own clone before pushing to main clone?

I am working on a projec开发者_Go百科t being version controlled by mercurial.

I have a clone. My friend has a clone.

My friend made some changes to his clone, and then pushed them to the main clone. I have made some changes to my clone, and am ready to push to the main clone. However, I want to incorporate his changes into my own clone, before I push to the main clone (I think that's the right way to go?)

How can I do this?

Thank you


Don't fear the merge. Many of us who cut our teeth on cvs get a sinking feeling when we have to merge branches. Branching and merging is natural and easy with Mercurial.

  1. Commit all your changes to your local hg
  2. hg pull to grab all the new nodes from the main repo, in your case these will make a new head
  3. hg merge to create your current working file state as a merge of two parent nodes
  4. use hg resolve -l to list any conflicted files, then edit them until you are happy
  5. use hg resolve -m to mark the fixed files as resolved
  6. use hg commit to actually commit the merge of the two parent nodes
  7. use hg push to let your friend get a copy of them

Remember mercurial deals in changesets. A changeset is just another name for a snapshot state of the project at some instant in time. Generally every changeset has one parent changeset, the previously committed state on which the state is based. The exception is the merge operation, which is special because it has two parent changesets.

Every changeset has zero or more children changesets. If it has zero children, a changeset is a "head". If it has more than 1 child, then it represents a divergent branch of development.


hg pull -u from the main clone. This will get all new changes from the main clone (including your friend's) and update your working copy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜