Subject: Re: Staging commits with visual diff tools?

From: David Aguilar <[email-masked]>
Date: Sun, 31 May 2015 19:25:17 -0700

On Sun, May 31, 2015 at 10:36:52AM +0100, John Lee wrote:
> On Sat, 30 May 2015, David Aguilar wrote:
> 
> >On Tue, May 26, 2015 at 09:50:49PM +0100, John Lee wrote:
> >>Hi
> >>
> >>Does anybody have code to stage commits using a the visual
> >>diff/merge tools supported by git-difftool?  Is there support in git
> ...
> >I'm a g/vim user, so git-cola is finely tuned for keyboard
> >usage.  If we implement these feature in Git, we should consider
> >providing the same workflows/hotkeys as cola.
> 
> Just to be clear I'm not planning on contributing my script back to
> git, it will just be a standalone script in a separate repo.
> 
> I'll give git-cola a try, thanks.  I just ran it and see it supports
> e.g. right click to stage and launching difftools -- does it also
> support launching a difftool to edit the index?

If you have stuff staged and use ctrl-d (or right-click->difftool),
git cola will run, "git difftool --staged -- <path>".

difftool will already point back to your worktree whenever
possible through the GIT_EXTERNAL_DIFF machinery that it uses.

After changes are made in the worktree you select files, lines,
or hunks and stage them.  Doing it in one step could be as
simple as having a script to automatically call "git add" after
difftool, or "ctrl-s" in cola to stage the whole file.

A not as simple (but potentially quite helpful) use case is a
tool that does a 3-way merge between HEAD, index, and worktree,
and writes the result back to the worktree (or index?).
The mergetool--lib backend could be leveraged for that feature.

Were you thinking of something like this, or something else?
Can you describe your use case a bit more?

It seems like we have most of the use cases covered with stock
git, but I'm not sure if I'm missing something.

cheers,
-- 
David