Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我获取了远程存储库,并且对它的引用存储在 中FETCH_HEAD,它有一些内容
FETCH_HEAD
cat .git/FETCH_HEAD # => d11f8ef4a4735a4193633ed2fed90e441d9ce0f8 branch 'hotfix' of xxx
但git-fetch什么也没显示
git-fetch
git show-ref FETCH_HEAD # => nothing
为什么?以及如何从 FETCH_HEAD 获取最后一次提交的 SHA?
使用rev-parse代替show-ref:
rev-parse
show-ref
git rev-parse FETCH_HEAD