[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

vc.el support for staging hunks/files

From: João Távora
Subject: vc.el support for staging hunks/files
Date: Fri, 03 Jan 2014 10:29:38 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> On Fri, Jan 3, 2014 at 3:57 PM, Eli Zaretskii <address@hidden> wrote:
>> I've managed to grasp all that, I've made an alias for "commit -a",
>> because that's what I almost always want.  (And why isn't that the
>> default, dammit?)

Yuri Khan <address@hidden> writes:
> Because staging is a key concept in git and it enables a whole lot of
> useful workflows. E.g. you can work all day and half the next day on a
> feature, making small formatting changes and fix coding style
> violations on your way as you spot them, then fire up a commit tool
> and make three commits, one for trivial formatting changes, another
> for coding style fixes, and a third one with the feature you actually
> worked on.
> Without staging, you would have to look at the diff, back up and
> revert some changes so that the working directory looks the way you
> want for one commit, then the other, then the next one. Or you would
> hold off fixing small things until you have committed the feature, and
> risk forgetting to do them.

+1 for git and +1 for this technique in particular. This has to be the
most useful thing that git brought to the table for me.

I also thought git commit -a would be always what I wanted, but I was
obviously wrong. Now my favourite workflow is to prototype a change with
some initial commits, semantically independent, sometimes even
empty. Then hack away at everything at once like in pre-VCS days. Then
use git add -p (or git gui) to make many "fixup" commits that can be
squashed onto the initial ones first set using `git rebase
--interactive`. Finally, when the stage is set, `git push`.

I admit I also had trouble with the git docs at first, but the "stage""
metaphor couldn't be cleverer.

My question is, since we're on emacs-devel: could vc.el support this

* git-add --edit seems to indicate so;

* diff-mode apparently has diff-marker calculation logic built in;

* magit supports it apparently and its git-rebase-mode.el could be used

Is there interest in such a feature?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]