Jon Kruger
Jon Kruger

Reputation: 4069

How to pull in upstream changes into a fork using Mercurial?

I've forked a Mercurial repository, and now I want to pull the changes from the main repository into my fork. If this were git, I would do something like...

git remote add upstream <url>
git pull upstream master

How do I do this sort of thing in Mercurial?

Upvotes: 36

Views: 7887

Answers (4)

Chris Dunder
Chris Dunder

Reputation: 309

You could also modify your hgrc file in your repo to use the special path names default and default-push.

default-push = ssh://[email protected]/<my_user>/<my_repo>
default = ssh://[email protected]/<other_user>/<other_repo>

Then you can pull from upstream (aka default) with

hg pull

and push to fork (aka default-push) with

hg push

Upvotes: 3

fmitchell
fmitchell

Reputation: 901

You could also modify your hgrc file in your repo

default = ssh://[email protected]/<my_user>/<my_repo>
upstream = ssh://[email protected]/<other_user>/<other_repo>

Then you can do

hg pull upstream

Upvotes: 50

Jim Hurne
Jim Hurne

Reputation: 7349

If you cloned the repository from the one you want to pull changes from, you can simply do:

hg pull

If you cloned the repository from another repository, you can:

hg pull <location of repository to pull from>

You'll then need to update your working copy:

hg update

That's the basics, anyway. More details are available in the Mercurial: The Definitive Guide

Upvotes: 28

Thilo
Thilo

Reputation: 262474

Have you tried the pull command?

hg pull http://master.com/master

If that does not work, please elaborate.

Upvotes: 4

Related Questions