Re: Staging commits with visual diff tools?
On Tue, May 26, 2015 at 09:50:49PM +0100, John Lee wrote:
Show 17 quoted lines
> Hi
>
> Does anybody have code to stage commits using a the visual
> diff/merge tools supported by git-difftool? Is there support in git
> itself somewhere, even?
>
> I'm looking for something functionally similar to git add -p
>
> Looking at the git-difftool source I can see how to write a command
> to do it, but wanted to check if it had already been implemented.
>
> Did I miss a way that already exists?
>
> Thanks
>
>
> John
If you're interested in existing staging tools then I would highly suggest looking at git-cola.
https://github.com/git-cola/git-cola
git clone git://github.com/git-cola/git-cola.git
git-cola is free software so it's pretty unique in many ways. I also wrote it, so that makes it that much more awesome ;-)
cola has a very slick interactive staging editor, interactive rebase, and a whole lot more.
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.
For staging, you can select lines, hit "s", and they'll be staged/unstaged. ctrl-u reverts unstaged edits, etc. The '?' hotkey shows the help, etc.
You can get extremely granular, moreso then "add -p", which is why it exists. When cola's diff editor is not sufficient, you can also use it to drive difftool, but only in ways that you can on the command-line already.
git-cola is written in Python(2+3) so it's easy to hack on, and quite portable.
cheers,
--
David