Switching between Mercurial branches
28,141
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.
Author by
wrongusername
Updated on February 23, 2020Comments
-
wrongusername over 4 years
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 usecheckout
instead.What are the differences? It seems to me that
checkout
updates the files in the working directory to the branch too, likeupdate -C
.