Re: Patch add: previous hunk across file boundaries
- Date: Fri, 11 May 2018 13:47:56 -0400
- From: Jeff King <peff@xxxxxxxx>
- Subject: Re: Patch add: previous hunk across file boundaries
On Fri, May 11, 2018 at 09:53:52AM -0500, Robert Dailey wrote:
> I noticed that when stepping into a new file while doing `git add -p`,
> pressing `k` or `K` does not go back to the previous file. Is this a
> bug? Is there a setting for it? I googled & checked out the git docs,
> I didn't find any specific information on this.
Nope, this is just the way that "-p" is implemented. It considers each
file independently (another artifact of this is that after completing
the hunks in a file the changes are staged, even if you quit while
looking at a hunk in another file).
I agree that it would be nicer to consider the whole set atomically,
with both "save and quit" and "quit but do not save" options. The way it
works now is mostly due to the way that "add -p" grew out of the whole
"add -i" interactive system, where you'd invoke the patch-adder on
specific files from a menu.
So no, there's not a way to do what you want right now short of writing