Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to combine two projects in Mercurial?

Tags:

mercurial

I have two separate mercurial repositories. At this point it makes sense that they "become one" because I want to work on the two projects simultaneously.

I'd really like the two projects to each be a subdirectory in the new repository.

  1. How do I merge the two projects?
  2. Is this a good idea, or should I keep them separate?

It seems I ought to be able to push from one repository to the other... Maybe this is really straight forward?

like image 974
jm. Avatar asked Aug 15 '08 22:08

jm.


People also ask

How do you combine two mercurial heads?

To start a merge between the two heads, we use the hg merge command. We resolve the contents of hello. c This updates the working directory so that it contains changes from both heads, which is reflected in both the output of hg parents and the contents of hello.

What does hg update do?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed.


1 Answers

I was able to combine my two repositories in this way:

  1. Use hg clone first_repository to clone one of the repositories.
  2. Use hg pull -f other_repository to pull the code in from the other repository.

The -f (force) flag on the pull is the key -- it says to ignore the fact that the two repositories are not from the same source.

Here are the docs for this feature.

like image 123
jm. Avatar answered Nov 10 '22 05:11

jm.