I'm selectively committing parts of a large file and I'd like to see more context around each hunk. Is this possible?
I'm selectively committing parts of a large file and I'd like to see more context around each hunk. Is this possible?
To confirm, this is still not possible in 2019.
An external tool like jjlee/git-meld-index can help:
git-meld-indexrunsmeld-- or any other git difftool (kdiff3,diffuse, etc.) -- to allow you to interactively stage changes to the git index (also known as the git staging area).
This is similar to the functionality of git add -p, and git add --interactive.
In some cases meld is easier / quicker to use than
git add -por the staging feature in tools likegit gui.
That's because meld allows you, for example, to:
- see more context,
- see intra-line diffs
- edit by hand and see 'live' diff updates (updated after every keypress)
- navigate to a change without saying '
n' to every change you want to skip
I just want to add that you can get the diff with full context using a solution like this https://stackoverflow.com/a/40683517/15410684 by Ezra.
git diff -U$(wc -l MYFILE)
gets you pretty close