wrongusername
wrongusername

Reputation: 18918

Switching between Mercurial branches

If I look at Mercurial's site, it seems to tell me to use update -C to switch between branches. Another Stack Overflow answer says to use checkout instead.

What are the differences? It seems to me that checkout updates the files in the working directory to the branch too, like update -C.

Upvotes: 41

Views: 29294

Answers (1)

Niall C.
Niall C.

Reputation: 10908

hg checkout and hg update are aliases for each other, so can be used interchangeably. From the help for hg update:

hg update [-c] [-C] [-d DATE] [[-r] REV]

aliases: up, checkout, co

update working directory (or switch revisions)

-C or --clean option is used to throw away uncommitted changes when switching.

Upvotes: 55

Related Questions