git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Petr Gregor <gregy@gregy.cz>
To: git@vger.kernel.org
Subject: bugreport: git checkout --recurse-submodules overwrites unstaged changes
Date: Wed, 19 Dec 2018 08:25:53 +0100	[thread overview]
Message-ID: <CAHsG2VT4YB_nf8PrEmrHwK-iY-AQo0VDcvXGVsf8cEYXws4nig@mail.gmail.com> (raw)

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

                 reply	other threads:[~2018-12-19  7:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHsG2VT4YB_nf8PrEmrHwK-iY-AQo0VDcvXGVsf8cEYXws4nig@mail.gmail.com \
    --to=gregy@gregy.cz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).