"commit --amend" and extraneous files
Victor Sudakov
vas at sibptus.ru
Sat Feb 8 09:42:02 UTC 2020
Marcin Kasperski wrote:
> > 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)
Both "hg amend" and "hg uncommit" are separate experimental extensions.
Why waste efforts on them?
And "hg rollback" is marked dangerous and deprecated because it does not
know about phases, isn't it ?
>
> 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.
My workflow is not advanced enough to use evolve. I occasionally need to
correct a commit message, or to fuse 2-3 successive commits into one. I'm
quite happy with histedit so far.
--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49 at fidonet http://vas.tomsk.ru/
More information about the Mercurial
mailing list