2

I'm new to git. I wanted to stash my changes and do a git pull origin master on my branch. The project that I'm working on has submodules.

Those are the commands I ran :

  1. git status - I can see all of my changes ( submodules + the main project )

  2. git stash push no errors or warnings. I ran this in the main directory of my project

  3. git status - All of the changes are gone ( submodules include )

  4. git pull origin master - works ( updates the submodules as well due to some configuration in our environment )

  5. git stash pop - no errors or warnings

  6. git status - all the work done in the submodules is gone.

What happened ? I know that git stash is going to make commits for my stashed work and after that do a git git reset --hard. Why is my submodule work gone ? How do you correctly stash a project with submodules ?

Thanks

Jeff Sloyer
  • 4,899
  • 1
  • 24
  • 48

1 Answers1

1

Will git stash reset submodules?

No, git stash push does not save the changes within submodules (see this question and the documentation that does not mention submodules at all) and it therefore does not revert those changes.

SebDieBln
  • 3,303
  • 1
  • 7
  • 21