Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial clone from a branch

We have a repository with three named branches, I wanted to clone one of the branches. Is there a mercurial command to do that? If I provide the path (of branch) with hg clone I get 404 error.

like image 225
Abidi Avatar asked Dec 28 '10 15:12

Abidi


People also ask

How do I clone a Mercurial repository?

Clone a remote Mercurial repositoryFrom the main menu, select Hg | Get from Version Control. The Get from Version Control dialog opens. In the dialog that opens, select Mercurial from the Version control list and specify the URL of the remote repository you want to clone. Click Clone.

How do I change my branch on Mercurial?

From the main menu, select Hg | Mercurial | Update to. In the Switch Working Directory dialog that opens, specify the target working directory: To switch to another line of development, choose Branch and select the desired branch from the list.

What is Mercurial branch?

Mercurial branch name is an attribute associated with a changeset. A new branch name can be started in the middle of a development line, not necessarily at a diverging point.


2 Answers

hg clone http://your/repo -r branchname should do the trick.

like image 56
Benjamin Pollack Avatar answered Oct 05 '22 04:10

Benjamin Pollack


Benjamin's right. But is that really what you want to do? In particular, you'll only get the changesets needed to make up that branch, and nothing else - and that would, for example, prevent you from pulling changesets in from the trunk or other branches. You might well be better off just cloning the entire repository and then simply working in the branch you are interested in; this will let you keep your repository in sync with the one you're pulling from more easily.

like image 40
Jay Maynard K5ZC Avatar answered Oct 05 '22 06:10

Jay Maynard K5ZC