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

[PATCH 0/4] prevent 'checkout -m' from losing staged changes

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Mar 22, 2019, 09:31 UTC
Message-ID
<20190322093138.13765-1-pclouds@gmail.com>

During the 'git switch' discusion, Phillip found out that staged changes could be silently lost when doing 'git checkout -m'. The first attempt [2] tries to fix it by warning and moving on, because t7201.10 would fail if we simply die() when there are staged changes.

This round, I update read-tree to be used in that test instead of 'checkout -m'. Then we are able to die().

I start a new thread to keep spam level down for other people, and to break free from 'git switch' thread because it's unrelated now.

Jonathan is included, just in case he still remembers something from 6a143aa2b2 (checkout -m: attempt merge when deletion of path was staged, 2014-08-12)

[1] https://public-inbox.org/git/7d3742d6-73e4-2750-6ecb-9edf761d96dd@gmail.com/ [2] https://public-inbox.org/git/20190319093910.20229-1-pclouds@gmail.com/

Nguyễn Thái Ngọc Duy (4):
  unpack-trees: keep gently check inside add_rejected_path
  unpack-trees: rename "gently" flag to "quiet"
  read-tree: add --quiet
  checkout: prevent losing staged changes with --merge
 Documentation/git-read-tree.txt |  4 ++++
 builtin/checkout.c              | 13 +++++++++++--
 builtin/read-tree.c             |  1 +
 t/t7201-co.sh                   |  9 ++-------
 unpack-trees.c                  | 25 +++++++++++--------------
 unpack-trees.h                  |  2 +-
 6 files changed, 30 insertions(+), 24 deletions(-)
-- 
2.21.0.548.gd3c7d92dc2
Next: Nguyễn Thái Ngọc Duy
Message 1 of 7 in “prevent 'checkout -m' from losing staged changes”
  1. 0/4 prevent 'checkout -m' from losing staged changesNguyễn Thái Ngọc Duy, Mar 22, 2019
  2. 1/4 unpack-trees: keep gently check inside add_rejected_pathNguyễn Thái Ngọc Duy, Mar 22, 2019
  3. 2/4 unpack-trees: rename "gently" flag to "quiet"Nguyễn Thái Ngọc Duy, Mar 22, 2019
  4. 3/4 read-tree: add --quietNguyễn Thái Ngọc Duy, Mar 22, 2019
  5. Philip OakleyMar 22, 2019
  6. 4/4 checkout: prevent losing staged changes with --mergeNguyễn Thái Ngọc Duy, Mar 22, 2019
  7. Elijah NewrenMar 25, 2019

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.