emacs-devel
[Top][All Lists]
Advanced

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

Re: VC mode and git


From: Alan Mackenzie
Subject: Re: VC mode and git
Date: Wed, 25 Mar 2015 19:23:49 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, Yuri.

On Thu, Mar 26, 2015 at 12:37:06AM +0600, Yuri Khan wrote:
> On Thu, Mar 26, 2015 at 12:19 AM, Alan Mackenzie <address@hidden> wrote:

> > I'm mystified as to what the git index is for.  What's its motivation,
> > what's it used for, what does it gain me in exchange for the extra
> > complexity?  Does anybody have a link to a justification?  I'm genuinely
> > curious about this.

> I view the index as a convenience.

> The use case goes like this. I work on a feature. At the same time, I
> notice some coding style violations, or bad spelling/grammar, or
> possible enhancements unrelated to the feature.

> Without using the index, I’d have to make a conscious effort to avoid
> mixing feature-related work with all those other good and useful
> modifications. Make notes on a piece of paper. Finish the feature
> work, commit, then go over the notes, do a few more commits.

> However, with the index, I can do all of these things as soon as I
> feel the need. Then I call up the Magit status buffer which shows me
> all unstaged changes. I go over them and stage only those that I want
> to put in a single commit, e.g. all the spelling fixes. I make a
> commit, then repeat with the reduced set of changes. With a single
> key, I can stage all changes, or all changes to a single file, or an
> individual hunk, or a selected region.

Isn't this what branches are meant to be for?

> Occasionally, a line will be changed in two or more unrelated ways. At
> this point, I have to go to the file buffer and temporarily edit the
> line to have the form I want to commit. After staging, I undo the
> change so the file in the working copy remains in its final form.

> Bottom line: The index allows me to do several unrelated changes in
> the working copy, then separate them in two or more commits.

OK.  Thanks for the elucidation.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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