Skip to content

Make 'git commit' not accidentally lose staged content

Nguyễn Thái Ngọc Duy git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest1 patch 13 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1commit: do not clobber the indexDocumentation/git-commit.txt builtin/commit.c cache.h +7 more+126 -160 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/1] Make 'git commit' not accidentally lose staged content

This is about mixing "git add -p" and "git commit -a" (or "git commit <path>") where you may accidentally lose staged changes. After the discussion with Jonathan, I'm going with a bit different approach than v1, this behavior now becomes default, and if the user wants the old behavior back, they can use --clobber-index.

Another change is "git commit <path>" is covered as well, as pointed out by Jacob.

I will need to add some test cases of course, if this direction is still promising. One thing I'm not sure about is whether want to deliberately clobber the index often, then perhaps we should add a config key to bring the old behavior back.

Nguyễn Thái Ngọc Duy (1):
commit: do not clobber the index

 Documentation/git-commit.txt     |  11 +++-
 builtin/commit.c                 | 105 ++++++++++++++++++++++++++++---
 cache.h                          |   1 +
 read-cache.c                     |  11 ++++
 t/t2201-add-update-typechange.sh |   2 +-
 t/t4015-diff-whitespace.sh       |   2 +-
 t/t7102-reset.sh                 |   2 +-
 t/t7500-commit.sh                |   2 +-
 t/t7502-commit.sh                |   4 +-
 t/t9350-fast-export.sh           |   2 +-
 10 files changed, 126 insertions(+), 16 deletions(-)
Signature · 1 line
2.19.0.rc0.337.ge906d732e7