{"thread":{"id":"50243","subject":"Stage or discard a hunk at a time?","startedAt":"2019-01-16T19:09:16Z","lastAt":"2019-04-30T23:19:27Z","messageCount":4,"participants":["Cameron Steffen","Jeff King","David Aguilar","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"366866","messageId":"CAAVFnNminTx_z9Y=jhzDnT0n5_zGD_k2SA84HQqMvKHJSvKcSA@mail.gmail.com","threadId":"50243","inReplyTo":null,"subject":"Stage or discard a hunk at a time?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2019-01-16T19:09:03Z","receivedAt":"2019-01-16T19:09:16Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"Hello,\n\nI have this feature idea for git. There should be a command that\neffectively combines git add -p and git checkout -p so that I can\nnavigate changed hunks and either stage or discard them.\n\nThere is already a SO question asking about this exactly...\nhttps://stackoverflow.com/questions/11538650/simultaneously-git-add-p-and-git-checkout-p\n\nHas this been discussed before? Is this a reasonable request? If so, I\nmight look into contributing the change myself.\n\nCameron\n"},{"id":"374265","messageId":"20190422192821.GA22798@sigill.intra.peff.net","threadId":"50243","inReplyTo":"CAAVFnNminTx_z9Y=jhzDnT0n5_zGD_k2SA84HQqMvKHJSvKcSA@mail.gmail.com","subject":"Re: Stage or discard a hunk at a time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-04-22T19:28:21Z","receivedAt":"2019-04-22T19:28:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 16, 2019 at 01:09:03PM -0600, Cameron Steffen wrote:\n\n> I have this feature idea for git. There should be a command that\n> effectively combines git add -p and git checkout -p so that I can\n> navigate changed hunks and either stage or discard them.\n> \n> There is already a SO question asking about this exactly...\n> https://stackoverflow.com/questions/11538650/simultaneously-git-add-p-and-git-checkout-p\n> \n> Has this been discussed before? Is this a reasonable request? If so, I\n> might look into contributing the change myself.\n\nThis is something I've sometimes wanted, too. I don't think it would be\n_too_ hard to do by modifying the add-interactive code. Both of those\noperations are driven by the same code; see the %patch_modes hash in\ngit-add--interactive.perl, which defines the various situations. You\nwould need to modify the actual code to handle the tri-state (there is\nnot just \"yes, apply it\" and \"no, leave it alone\", but now \"apply /\ndiscard / skip\"). But it seems do-able.\n\nIf you do plan to work on it, be aware that the perl bits of\nadd--interactive are being re-written in C. So it might make sense to\ntarget the new C implementation instead of modifying the perl.\n\n-Peff\n\nPS Sorry for the slow reply, and I hope you're still interested in the\n   topic. Your message got throw onto my \"interesting, should reply\"\n   pile and I just happened to see it while clearing out old mails. :)\n"},{"id":"374611","messageId":"20190428084718.GA21060@gmail.com","threadId":"50243","inReplyTo":"CAAVFnNminTx_z9Y=jhzDnT0n5_zGD_k2SA84HQqMvKHJSvKcSA@mail.gmail.com","subject":"Re: Stage or discard a hunk at a time?","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2019-04-28T08:47:18Z","receivedAt":"2019-04-28T08:47:24Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, Jan 16, 2019 at 01:09:03PM -0600, Cameron Steffen wrote:\n> Hello,\n> \n> I have this feature idea for git. There should be a command that\n> effectively combines git add -p and git checkout -p so that I can\n> navigate changed hunks and either stage or discard them.\n> \n> There is already a SO question asking about this exactly...\n> https://stackoverflow.com/questions/11538650/simultaneously-git-add-p-and-git-checkout-p\n> \n> Has this been discussed before? Is this a reasonable request? If so, I\n> might look into contributing the change myself.\n> \n> Cameron\n\nInstall Git Cola.\n\nIt's a powerful Git GUI with a keyboard-centric workflow.\nYou can do this completely through keyboard shortcuts\n(or a mouse if you prefer).\n\nTypically:\n\n\t$ git cola\n\n\tctrl-k: focus the status widget\n\tj,k: navigate up/down the file list\n\tctrl-s: stage files\n\tctrl-u: revert files to index\n\n\tctrl-j: focus the diff widget to operate at the line/hunk level\n\tj, k: move the cursor up/down lines, hold shift to select lines\n\ts: to stage selection, or current hunk if no lines are selected\n\tctrl-u: revert the selection, or current hunk, to match the index\n\nhttps://github.com/git-cola/git-cola\n\nhttps://git-cola.github.io/downloads.html\n-- \nDavid\n"},{"id":"374734","messageId":"nycvar.QRO.7.76.6.1904301918230.45@tvgsbejvaqbjf.bet","threadId":"50243","inReplyTo":"20190422192821.GA22798@sigill.intra.peff.net","subject":"Re: Stage or discard a hunk at a time?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-04-30T23:19:19Z","receivedAt":"2019-04-30T23:19:27Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 22 Apr 2019, Jeff King wrote:\n\n> On Wed, Jan 16, 2019 at 01:09:03PM -0600, Cameron Steffen wrote:\n>\n> > I have this feature idea for git. There should be a command that\n> > effectively combines git add -p and git checkout -p so that I can\n> > navigate changed hunks and either stage or discard them.\n> >\n> > There is already a SO question asking about this exactly...\n> > https://stackoverflow.com/questions/11538650/simultaneously-git-add-p-and-git-checkout-p\n> >\n> > Has this been discussed before? Is this a reasonable request? If so, I\n> > might look into contributing the change myself.\n>\n> This is something I've sometimes wanted, too. I don't think it would be\n> _too_ hard to do by modifying the add-interactive code. Both of those\n> operations are driven by the same code; see the %patch_modes hash in\n> git-add--interactive.perl, which defines the various situations. You\n> would need to modify the actual code to handle the tri-state (there is\n> not just \"yes, apply it\" and \"no, leave it alone\", but now \"apply /\n> discard / skip\"). But it seems do-able.\n>\n> If you do plan to work on it, be aware that the perl bits of\n> add--interactive are being re-written in C. So it might make sense to\n> target the new C implementation instead of modifying the perl.\n\nThe work on that is tracked in PRs 170-175 on\nhttps://github.com/gitgitgadget/git, i.e.\n\n- https://github.com/gitgitgadget/git/pull/170\n- https://github.com/gitgitgadget/git/pull/171\n- https://github.com/gitgitgadget/git/pull/172\n- https://github.com/gitgitgadget/git/pull/173\n- https://github.com/gitgitgadget/git/pull/174\n- https://github.com/gitgitgadget/git/pull/175\n\nCiao,\nJohannes\n"}]}