All of lore.kernel.org
 help / color / mirror / Atom feed
* Stage, test, and commit only some changes, then repeat
@ 2022-01-30 20:17 Géry Ogam
  2022-01-30 21:13 ` Johannes Sixt
  2022-01-31 16:27 ` Sergey Organov
  0 siblings, 2 replies; 8+ messages in thread
From: Géry Ogam @ 2022-01-30 20:17 UTC (permalink / raw)
  To: git

Hello,

I would like to stage, test, and commit only *some* changes of the working tree, and then repeat this process with the remaining changes.

My current solution (published at https://stackoverflow.com/a/70914962/2326961):

1. Stage some changes:
   ```
   git add -p file
   ```
2. Save away the remaining changes:
   ```
   git diff >patch
   git stash push -k
   ```
3. Test the staged changes.
4. Commit the staged changes:
   ```
   git commit
   ```
5. Restore the remaining changes:
   ```
   git apply patch
   ```
6. Go to step 1.

It is not ideal because a) it uses a patch file for saving the remaining changes; b) it uses the stash only for setting the working tree to the index state.

It would be ideal if I could save *only* the remaining changes in the stash instead of resorting to a patch file. How to do it?

Best,

Géry Ogam


[Info système]
version git ::
git version 2.35.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64
info compilateur : clang: 13.0.0 (clang-1300.0.29.3)
info libc : aucune information de libc disponible
$SHELL (typically, interactive shell): /bin/zsh


[Crochets activés]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-01  8:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-30 20:17 Stage, test, and commit only some changes, then repeat Géry Ogam
2022-01-30 21:13 ` Johannes Sixt
2022-01-31 21:57   ` Géry Ogam
2022-01-31 16:27 ` Sergey Organov
2022-01-31 21:33   ` Géry Ogam
2022-01-31 21:56     ` Sergey Organov
2022-01-31 22:22       ` Géry Ogam
2022-02-01  8:37         ` Sergey Organov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.