git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unified workflow for `git add/checkout --patch`?

From
TETimothy Eccleston <timothy.perisho.eccleston@gmail.com>
Date
Oct 21, 2021, 22:19 UTC
Message-ID
<CACYzLDcO4OATYYZ6AtJnJTKS9EKUKNRJY5_Rb=y62gWFFwoDhg@mail.gmail.com>
In-Reply-To
<CACYzLDcFjwaJkgVUemD_KqkoGhV_5OYrECddDuxa-o5FpZ6XMA@mail.gmail.com>
Hi,
I really like both these features:
- git add -p
- git checkout -p

My typical workflow I like to use them after a long and complex coding sessions where I want to double-check my work, making edits and adding sets of patches into sequential commits to keep related changes together topically.

In the process of using git add -p to grab some patches, I may notice other patches I don't want (especially after I've used the "e" command in `git add -p` to edit a patch - I usually want to drop the remaining, unstaged version of the patch right then). But, instead, I have to go through git add -p and then git checkout -p and likely back and forth several times, each time skipping through all the same undecided or postponed patches I am waiting on for later.

Note: I recently discovered the "j" and "J" subcommands which are
useful to postpone decisions on certain patches, but only if I
restrict myself to just git add or git checkout. If I want to do both,
I still have to cycle back through from the top each time. I suppose I
could use stash -p to really hide patches I'm saving for later, but I
still have to exit my workflow and start another command, requiring
multiple passes. OTOH, a unified git add/checkout/stash --patch would
be amazing!

My request It would be really nice if there were a unified command workflow where I could add or checkout patches or even partial patches (after editing a patch in git add), on a case by case basis in a single pass.

Does anyone know a way to do this or do you think it's worth making a new feature in git to handle it?

Thanks! Tim

Next: Phillip Wood
Message 1 of 3 in “Re: Unified workflow for `git add/checkout --patch`?”
  1. Timothy EcclestonOct 21, 2021
  2. Phillip WoodOct 25, 2021
  3. Timothy EcclestonOct 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.