by rtpg · 2y ago · 0 comments
I don't fully believe this, but I kind of believe that having the staging model is what allows git to be very good at modelling almost anything nicely. New workflows can be easily rolled out because we have this phase separation between committing and simply staging.
And just as a general thing, `git add -p` totally made me a better developer overnight, at least in terms of actually rereading my changes seriously (and fixing them up etc). The model isn't necessary to this kind of workflow but it helps!
So enable Hg queues:
* https://wiki.mercurial-scm.org/MqExtension
> Git is the only DistributedSCM that exposes the concept of index or staging area. The others may implement and hide it, but in no other case is the user aware or has to deal with it.
> Mercurial's rough equivalent is the DirState, which controls working copy status information to determine the files to be included in the next commit. But in any case, this file is handled automatically. Additionally, it is possible to be more selective at commit time either by specifying the files you want to commit on the command line or by using hg commit --interactive.
[…]
> If you need the index, you can gain its behavior (with many additional options) with mercurial queues (MQ). Simple addition of changes to the index can be imitated by just building up a commit with hg commit --amend (optionally with --secret, see phases).
* https://wiki.mercurial-scm.org/GitConcepts#Git.27s_staging_a...
What I don’t like is that git’s index is called an index (what does “index” have to do with its usecases?) and that the index is live even when you don’t want it. It should be opt-in, not opt-out.
See perhaps:
> ! This extensions is deprecated, the feature is now part of Mercurial core as hg commit --interactive.
> The record extension provides the record command, which may be used in lieu of commit. This command lets you choose which parts of the changes in a working directory you'd like to commit, at the granularity of patch hunks. It is similar in spirit to the darcs record command.