Question about Source Control

Chris Angelico rosuav at gmail.com
Mon Mar 24 01:30:28 CET 2014


On Mon, Mar 24, 2014 at 11:19 AM, Cameron Simpson <cs at zip.com.au> wrote:
> I'm particularly fond of "hg record" (or the similar extension, "hg
> crecord"), which lets you commit just parts of a modified file.
>
> When I'm in a debugging branch, it gradually turns into a huge diff.
> "hg record" lets me commit specific parts of a diff in a single
> commit. Every so often I spent a little while cleaning out related
> changes that are going to stay so that the final diffness consists
> of debug statements and hacks-in-progress; much smaller.
>
> So I'll pick a file and run an "hg record that-file" and pick all
> the diff parts that involve, say, removing some parameter. And in
> goes a single commit with just that feature change. Lather, rinse,
> repeat for other small concrete changes.
>
> And then my "hg diff" is back to being managably readable.
>

Absolutely agree. With git, the same functionality can be done by
making use of the staging area; you can either add an entire file (all
its changes), or do a partial add with "git add -p" or (more
conveniently, but requires a GUI) "git gui". I do that *very*
frequently. The only thing I would really like is a simple way to say
"stage/commit the lines from here to there"; with git gui, I can
either stage an entire hunk (everything until the next point where
there's enough unchanged lines that the context breaks) or a single
line (either an insertion or a removal). Gets tedious when you want to
stage half of a large hunk. But other than that, yes, the
functionality is awesome, letting you fidget your edits into readable
commits.

ChrisA



More information about the Python-list mailing list