* Possible bug in git stash with submodule.recurse
@ 2019-10-10 15:26 Jakob Jarmar
0 siblings, 0 replies; only message in thread
From: Jakob Jarmar @ 2019-10-10 15:26 UTC (permalink / raw)
To: git
Hi,
I ran into an issue where git stash seems to be losing modified content
from submodules without warning, if submodule.recurse is true. See
below for an example:
1. enable submodule.recurse:
~ $ git config --global submodule.recurse true
2. create the repo to be used as a submodule:
~ $ git init sub
Initialized empty Git repository in /home/jakob/sub/.git/
~ $ cd sub/
~/sub $ touch sub.txt
~/sub $ git add sub.txt
~/sub $ git commit -m initial
[master (root-commit) 651a90c] initial
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 sub.txt
~/sub $ cd ..
3. create the main repo, add sub as a submodule:
~ $ git init main
Initialized empty Git repository in /home/jakob/main/.git/
~ $ cd main/
~/main $ touch main.txt
~/main $ git add main.txt
~/main $ git submodule add ../sub/
Cloning into '/home/jakob/main/sub'...
done.
~/main $ git commit -m initial
[master (root-commit) 2f9f4e8] initial
3 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 100644 main.txt
create mode 160000 sub
4. make *both* main and sub dirty (if main is clean, stash does nothing):
~/main $ echo changes > main.txt
~/main $ echo changes > sub/sub.txt
~/main $ git diff sub/
Submodule sub contains modified content
5. git stash and git stash pop:
~/main $ git stash
Saved working directory and index state WIP on master: 2f9f4e8 initial
~/main $ git stash pop
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: main.txt
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (00a38b73407e7e3041c9459ef6d61bc90940b91f)
~/main $ git diff sub/
~/main $
At this point, I can't seem to find any way to retrieve the changes
made to sub/sub.txt.
Thanks,
Jakob
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-10-10 15:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 15:26 Possible bug in git stash with submodule.recurse Jakob Jarmar
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).