8

git add -p allows to stage selected parts of working tree changes to the index so that an uncommitted set of changes can be split into multiple commits.

Instead of git add -p, I would like to use meld or another graphical diff tool available on Linux (e.g. kdiff3) to stage changes.

I'm particularly keen to use a tool like meld that has a live intra-line diff viewer and those little arrows and x marks that let you merge and delete chunks of code quickly (or something very similar to that).

How can I do that?

Croad Langshan
  • 908
  • 9
  • 20

2 Answers2

4

The git-meld-index project allows meld to be used in order to incrementally update the index.

Mark
  • 396
  • 2
  • 5
1

Meld doesn't have such integration. However, you can use git gui.

On Linux, there is also Gitg.

On Windows and OS X, the GitHub app has this feature.

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • 2
    The thing I really like about using meld for this kind of thing is the ability to see intra-line diffs update in real time while I do things like: edit by hand, use the little merge arrows to merge diff hunks, use x marks to delete stuff, etc. Plus it also makes it easy for me to browse around and find the right bit of code. Does git gui or gitg do that (I don't think so but correct me if I'm wrong...)? – Croad Langshan May 21 '15 at 17:30
  • Also, it seems meld needs no 'integration' to do this job. Rather, meld needs to be run with appropriate inputs (and something suitable done with the output). – Croad Langshan May 22 '15 at 19:51
  • @CroadLangshan That is exactly the sort of integration OP needs. – Pavel Šimerda Jul 23 '19 at 09:23
  • @PavelŠimerda I am the OP, and it honestly isn't: here's a tool that does it without integration (in the sense of integration I was referring to -- i.e. without changes to meld): https://github.com/jjlee/git-meld-index . It's the accepted answer. Hm, unless you're just objecting to the sense in which I used the word integration: in which case yes of course, I'm fine with using it that way too. But you see the distinction I was making? – Croad Langshan Aug 25 '19 at 11:08