Mercurial: Merging one file between branches in one repo

前端 未结 3 1431
天涯浪人
天涯浪人 2020-11-29 21:21

When I have two branches in Hg repo, how to merge only one file with another branch, without having all other files from changeset merged?

Is it possible to merge on

3条回答
  •  醉酒成梦
    2020-11-29 22:15

    Nope. Mercurial works on a changeset basis.

    But you can do a "dummy merge" where you ignore the incoming changes from one of the branches. Before you commit you could then revert selected files to whatever state you want:

    % HGMERGE=internal:local hg merge     # keep my files
    % hg revert --rev other-branch a.txt  # update a.txt to other branch
    % hg commit -m 'Dummy merge to pick a.txt from other-branch.'
    

    Maybe that will help you a bit.

提交回复
热议问题