41

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
wrongusername
  • 18,564
  • 40
  • 130
  • 214

1 Answers1

55

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.

anatoly techtonik
  • 19,847
  • 9
  • 124
  • 140
Niall C.
  • 10,878
  • 7
  • 69
  • 61