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

bugreport: git checkout --recurse-submodules overwrites unstaged changes

From
PGPetr Gregor <gregy@gregy.cz>
Date
Dec 19, 2018, 07:25 UTC
Message-ID
<CAHsG2VT4YB_nf8PrEmrHwK-iY-AQo0VDcvXGVsf8cEYXws4nig@mail.gmail.com>

Hello, I believe we found a reproducible bug in git checkout --recurse-submodules command. Documentation says, that this command should not overwrite unstaged changes in submodules unless -f is given. In reality local changes can be accidentally overwritten even without -f flag.

I reproduced the issue with git version 2.20.1 like this:

git init git submodule add https://github.com/Gregy/znapzend-debian submodule git add . && git commit -m 'first' git checkout -b 'newbranch' (cd submodule && git checkout a3a7b0) git add . && git commit -m 'set new branch to different submodule commit' echo 'test' > submodule/debian/compat #create an unstaged change git checkout master --recurse-submodules #my change is overwritten

Thank you for maintaining git, it is awesome!
Petr Gregor
Message 1 of 1 in “bugreport: git checkout --recurse-submodules overwrites unstaged changes”
  1. Petr GregorDec 19, 2018

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.