0

I have a local repo with 50 submodules. My teammates recently made some deletions on the remote repo of 5 submodules. So I'm behind one commit and have extra submodules.

I want to update my local I recently Pull to get my local up to date with the remote remo. But it's telling me that I either need to commit or stash the uncommitted changes.

I still don't fully understand the difference. I just want my local repo to be exactly up to date with what's on my remote repo, so it automatically deletes the extra submodules that are on my current local repo.

Which of the two would be the correct option to do this?

And my last question, if I chose commit. What would be the purpose of committing the changes if later on I would Pull what's on the remote repo and end up changing the things I just committed anyways? Thanks

tadm123
  • 8,294
  • 7
  • 28
  • 44
  • 2
    I mean either is fine. It would probably be easier to stash, pull, then apply the stash. You could commit and pull but you might have to deal with some messy merge issues. Ideally, you would always make these changes to a different branch, and merge to an up-to-date default branch (ex main) and never need to deal with this though. – joshmeranda Apr 26 '23 at 19:57
  • Thanks but the thing is that I don't want to apply my changes later on after I stash them, I just want my local to be exactly up to date with the remote repo. – tadm123 Apr 26 '23 at 20:06
  • 2
    If you don't want to keep those changes then *do not commit them*. Stash removes uncommitted changes, and you can optionally re-apply them later. – Jim Redmond Apr 26 '23 at 21:25
  • Dunno how submodules work but commits are in general better than stashing. Once you have committed something it’s easy to get rid of it and bring it back again. Stashes however are not nice [if you drop one too many times](https://stackoverflow.com/questions/89332/how-do-i-recover-a-dropped-stash-in-git). – Guildenstern Apr 28 '23 at 19:57

0 Answers0