{"thread":{"id":"48465","subject":"Patch add: previous hunk across file boundaries","startedAt":"2018-05-11T14:53:57Z","lastAt":"2018-05-11T17:48:01Z","messageCount":2,"participants":["Robert Dailey","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"347360","messageId":"CAHd499CKJTnjvPSMqoFZDWw-6PYX4_AxLr0yC6CaMi7VO9TBzQ@mail.gmail.com","threadId":"48465","inReplyTo":null,"subject":"Patch add: previous hunk across file boundaries","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2018-05-11T14:53:52Z","receivedAt":"2018-05-11T14:53:57Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"I noticed that when stepping into a new file while doing `git add -p`,\npressing `k` or `K` does not go back to the previous file. Is this a\nbug? Is there a setting for it? I googled & checked out the git docs,\nI didn't find any specific information on this.\n"},{"id":"347370","messageId":"20180511174756.GB19670@sigill.intra.peff.net","threadId":"48465","inReplyTo":"CAHd499CKJTnjvPSMqoFZDWw-6PYX4_AxLr0yC6CaMi7VO9TBzQ@mail.gmail.com","subject":"Re: Patch add: previous hunk across file boundaries","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-05-11T17:47:56Z","receivedAt":"2018-05-11T17:48:01Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 11, 2018 at 09:53:52AM -0500, Robert Dailey wrote:\n\n> I noticed that when stepping into a new file while doing `git add -p`,\n> pressing `k` or `K` does not go back to the previous file. Is this a\n> bug? Is there a setting for it? I googled & checked out the git docs,\n> I didn't find any specific information on this.\n\nNope, this is just the way that \"-p\" is implemented. It considers each\nfile independently (another artifact of this is that after completing\nthe hunks in a file the changes are staged, even if you quit while\nlooking at a hunk in another file).\n\nI agree that it would be nicer to consider the whole set atomically,\nwith both \"save and quit\" and \"quit but do not save\" options. The way it\nworks now is mostly due to the way that \"add -p\" grew out of the whole\n\"add -i\" interactive system, where you'd invoke the patch-adder on\nspecific files from a menu.\n\nSo no, there's not a way to do what you want right now short of writing\npatch.\n\n-Peff\n"}]}