"commit --amend" and extraneous files

Marcin Kasperski Marcin.Kasperski at mekk.waw.pl
Fri Feb 7 20:15:10 UTC 2020


> Can you tell me why there are so many seemingly overlapping commands and
> extensions for a similar purpose? There is "hg rollback", "hg uncommit",
> "hg strip" and maybe more.

Because devs lost many man-years migrating to py3 and didn't have time to
stabilize command APIs around evolve and history editing? Well, my bet.

In fact, from commands above, `hg rollback` is deprecated and `hg strip`
is mostly and after all a way to remove some not-yet-pushed commits
from the history, so I don't find them confusing.

As I understand now, crucial „quick immediate commit edit” commands
are to stabilize on:

- `hg amend`  aka  `hg refresh`
     (JUST update last commit according to current workdir, damnit!)
- `hg commit --amend`
     (fix last commit in more controlled way: requires -m editing,
      allows specifying files as args etc)
- `hg uncommit`
     (remove some files/changes from last commit, mostly cmdline trick
      because expressing that as args to commit would be very troublesome)

Mayhaps it would be less confusing if there instead existed single 
`hg amend` with different options or even subcommands to express what
is to be done (maybe `hg amend --remove blah.cxx`, `hg amend --add bleh.py`,
`hg amend --update *.cxx`), but this is probably too late for this
discussion. And those commands are in fact handy once picked up.

What is more confusing is that all those commands can in fact behave
differently (from widely different help page to really different effect
in the repository) depending on the fact whether evolve is enabled. So I
hope to see evolve enabled for good some day.



More information about the Mercurial mailing list