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

Pressing Ctrl-C during 'git checkout <branch-name>' messes up the repository

From
YYuri <yuri@rawbw.com>
Date
Jul 15, 2023, 04:26 UTC
Message-ID
<fe3c68d5-124e-5a87-881a-21ad8e492f76@tsoft.com>

It stops in some intermediate state, and git still says that it is on the main branch, but 'git checkout' deletes files that were added only in the main branch,

'git reset --hard HEAD' fixes the main branch, bit now it is impossible to switch to the other branch because it says that "some files would be overwritten", which shouldn't be the case.

All operations should be atomic.

When the user presses Ctrl-C, the correct action would be to cleanly return to the initial branch.

git-2.41.0
Thanks,
Yuri
Next: brian m. carlson
Message 1 of 6 in “Pressing Ctrl-C during 'git checkout <branch-name>' messes up the repository”
  1. YuriJul 15, 2023
  2. brian m. carlsonJul 16, 2023
  3. Junio C HamanoJul 16, 2023
  4. YuriJul 17, 2023
  5. Konstantin KhomoutovJul 17, 2023
  6. Andreas SchwabJul 17, 2023

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.