1

Why does git status say Changed but not updated but git pull says Already up-to-date?

E.g.

$ git st
# On branch develop
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   roles/role-A (new commits)
#
no changes added to commit (use "git add" and/or "git commit -a")
[snowcrash@snow ansible-playbooks]$ git pull
Already up-to-date.
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

1 Answers1

0

A parent repo with a submodule records a gitlink (a special entry in the index of the main repo)

Since new commits have been done in the nested repo roles/role-A, git status mentions that the gitlink roles/role-A

If that same gitlink (which is a reference to a SHA1 of the sub-repo) has not changed remotely, you can do a git pull (that will update other files, but not the roles/role-A gitlink)

If nothing has changed remotely, a git pull would say "up-to-date", even if you had tons of modification/commits locally, in your main repo or in your sub-repo.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250