How to merge two Mercurial repositories into one

I need to separate Mercurial repositories. One of them is the main connecting element for the project, and the other is a branch with a set of additional changes.

There is one central place for the project repository in which I would like both connecting lines and branches to be accessible. What I would like to do is merge the two repositories into one, but still allow access to the branch via tags or something like that. This will allow developers to check the main code, but also be able to switch to work with the branch if it requires further changes. I also want to make sure that any code in the trunk does not accidentally fall into the branch. Any changes to the branch must be explicit and deliberate.

What is the best way to do this?

0
source share
1 answer

As Brandon says, just push from the repo branch to the trunk or pull the branch into the trunk.

You can then choose whether you want to merge the branch and trunk together or leave them separate. If you push from a branch into the trunk, you may receive a warning about several heads. Just do push -f if you want them separated. (pull cannot give a warning)

You can merge the branch changes into a trunk and, if you wish, continue further work in the branch. In general, I put every release so that I can easily return to everything that went out the door.

When you created the branch, did you clone it into another directory? If so, it will be more difficult to find the branch after it pulls it into the trunk repository. You can read bookmarks to tag a branch. Also see how several chapters work.

Note. Another option is to use named branches , which forever points to a branch. You did not need to do anything to switch to it later.

+1
source

Source: https://habr.com/ru/post/1479641/


All Articles