0

This is a great article on submodules but I have a question I might be able to get answered here.

I have my repo/submodule here: home/submodule

and then I have it included as a submodule here: home/core/submodule

but if I go into home/submodule and make some changes, then to a git add, git commit, git push that is all fine.

but then if I go into home/core/submodule and do a git status it will say it is up to date, even though it is/should be 1 commit behind.

If I then stay in home/core/submodule and do a git pull, it will pull down the changes, even though it does not think there is any, and it will then be up to date with the remote.

Is there something I am doing wrong, or am I mis-using submodules?

related q Git submodule to track remote branch and Git submodules workflow
EDIT - good resource here https://git-scm.com/book/en/v2/Git-Tools-Submodules - particularily around git diff --submodule to show the new commits in the submodule.

Community
  • 1
  • 1
HattrickNZ
  • 4,373
  • 15
  • 54
  • 98
  • 1
    Possible duplicate of [Confused by 'up-to-date' message in git workflow](http://stackoverflow.com/questions/39869483/confused-by-up-to-date-message-in-git-workflow) – 1615903 Oct 28 '16 at 05:01
  • may need to read updating submodules again in the link above – HattrickNZ Oct 31 '16 at 01:08

1 Answers1

2

Git doesn't automatically check any remotes for new content. It only communicates with the remote when you do git fetch or git pull (or git push).

If you first did git fetch, it would have shown you that you are behind by X commits.

1615903
  • 32,635
  • 12
  • 70
  • 99
  • tks, but can I just confirm, if i do a git remote -v and it points at `X` and then I do a git status, should the status not be relative to `X`? this is what I am expecting in submodules, but maybe that is my mistake? – HattrickNZ Oct 30 '16 at 19:18