best practices in mercurial: branch vs. clone, and partial merges?

前端 未结 3 1513
-上瘾入骨i
-上瘾入骨i 2020-12-12 10:26

...so I\'ve gotten used to the simple stuff with Mercurial (add, commit, diff) and found out about the .hgignore file (yay!) and have

3条回答
  •  执笔经年
    2020-12-12 10:43

    For question 1, you need to be a little clearer about what you mean by "changes". Which of these do you mean:

    1. "I want to pull some, but not all, of the changesets in a different branch into this one."
    2. "I want to pull the latest version of some, but not all, of the files in a different branch into this one."

    If you mean item 1, you should look into the Transplant extension, specifically the idea of cherrypicking a couple of changesets.

    If you mean item 2, you would do the following:

    • Update to the branch you want to pull the changes into.
    • Use hg revert -r --include to change the contents of those files to the way they are on the other branch.
    • Use hg commit to commit those changes to the branch as a new changeset.

    As for question 2, I never use repository clones for branching myself, so I don't know. I use named branches or anonymous branches (sometimes with bookmarks).

提交回复
热议问题