0

Basically the opposite of this question.

I'm cloning a repo that has a submodule in it. After running

git submodule init
git submodule update

when I cd to the subdirectory that contains the submodule, I expect to see that I am in a detached HEAD state when I do git status but I'm not. I read up on submodules and I see you can setup tracking for a submodule but I have never done those steps.

I've reproduced this behavior with fresh clones of the repo in different directories; it's as if the submodules are being setup to be tracked right away somehow. My co-worker running on the same machine, same version of git, same .gitconfig (except usernames) gets the expected behavior (detached HEAD in submodule directory) with the same repository.

Screencap of clone and submodule initialization/update

Murkantilism
  • 1,060
  • 1
  • 16
  • 31
  • 1
    It's hard to read the screenshot, but it looks to me like you're in a *different* directory named `common`, not in the *submodule* directory named `common`. An easy way to be sure is to use `git rev-parse --show-toplevel` which will tell you where the work-tree lives: if it's the main repo work-tree, you're still in the main repo; if it's the submodule repo, you're in the submodule. – torek Feb 15 '19 at 19:57
  • Yep, you're right, two directories with the same name – Murkantilism Feb 15 '19 at 20:19

1 Answers1

0

@torkek is correct, my coincidence the submodule was in a different subdirectory also named common >.<

Murkantilism
  • 1,060
  • 1
  • 16
  • 31