Adarsh Hiwrale
Adarsh Hiwrale

Reputation: 146

In mercurial how to pull?

I have cloned a branch name abc from bitbucket into my local by following command:

$ hg clone -b abc https://bitbucket.org/asda/da/

Next i have have created a branch name xyz from abc branch and it is my working branch .

$ hg branch <branch name>

Now my question was can i pull changes from remote abc to local xyz directly by following command:

$ hg pull -b abc
$ hg update

I always checkout to abc branch and then pull changes. When i pull changes nothing changes very confused regarding this.After pull it shows total number of files changed .But not able to see changes.

Another question is that if i pull changes on branch abc and when i checkout xyz branch does all the changes get updated in xyz branch automatically?

Please help me out.

Upvotes: 0

Views: 1875

Answers (1)

alexis
alexis

Reputation: 50220

Draw a picture of the branches. When you pull new changesets, they are always added to the same branch, and in the same sequence, that they occupied in the upstream repository. In other words when you pull from abc you extend abc. You don't need to switch to abc before you pull, and you don't need to update afterwards.

a--a--a--a--a1--a2
          \
           x--x--x

(a = branch abc; a1,a2 = new changesets on abc; x = branch xyz)

The new changesets you pulled make no difference to the tip of branch xyz. To benefit from them in your branch, use the command merge.

hg update xyz
hg merge a2
hg commit

Then you'll be at point X', the new tip of xyz.

a--a--a--a---a1---a2
          \        \
           x--x--x--X'

Upvotes: 1

Related Questions