From: Jeff King <peff@peff.net>
To: John Lee <jjl@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Staging commits with visual diff tools?
Date: Wed, 27 May 2015 03:28:26 -0400 [thread overview]
Message-ID: <20150527072826.GC6898@peff.net> (raw)
In-Reply-To: <alpine.DEB.2.10.1505262147230.3709@alice>
On Tue, May 26, 2015 at 09:50:49PM +0100, John Lee wrote:
> 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?
git-gui has a visual staging tool, and I think some other git interfaces
do, too (e.g., tig). But I don't think there is a way to interact with
an arbitrary 3rd-party diff tool. I would think doing so would depend on
the diff tool itself; what facility does it provide for picking lines
or a hunk out of a diff and communicating it back to git to stage?
If you are interested in looking further, see how the %patch_mode hash
is defined in git-add--interactive.perl. Specifically, note that "add
-p" is just one case: diff against the index and apply with "apply
--cached". But once you have a separate tool for picking hunks, you
should be able to drop in the different DIFF/APPLY pairs to implement
"checkout -p", etc.
-Peff
next prev parent reply other threads:[~2015-05-27 7:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 20:50 Staging commits with visual diff tools? John Lee
2015-05-27 7:28 ` Jeff King [this message]
2015-05-27 7:34 ` John Lee
2015-05-29 9:57 ` Michael J Gruber
2015-05-31 1:59 ` David Aguilar
2015-05-31 9:36 ` John Lee
2015-06-01 2:25 ` David Aguilar
2015-06-01 19:36 ` John Lee
2015-06-27 23:23 ` John Lee
2015-06-28 17:56 ` John Lee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150527072826.GC6898@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jjl@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).