为什么`git status`说'已更改但未更新',但`git pull`表示“已经是最新的”?

时间:2017-09-28 15:45:15

标签: git

为什么git statusChanged but not updatedgit pullAlready 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.

1 个答案:

答案 0 :(得分:0)

带子模块的父仓库记录 gitlink (主仓库的special entry in the index

由于在嵌套的repo roles/role-A中完成了新的提交,git status提到了gitlink roles/role-A

如果相同的gitlink(它是对sub-repo的SHA1的引用)没有远程更改,你可以执行git pull(将更新其他文件,但不更新roles/role-A gitlink)< / p>

如果没有任何远程更改,即使您在本地,主回购或子回购中有大量修改/提交,git pull也会说“最新”。