Possible Duplicate:
How can I check whether a git repository has any commits in it?
确定存储库是否为空(例如刚创建后)的最佳方法是什么?
最佳答案
一种快速方法是在 .git/objects
目录中查找文件。如果没有,那么您就知道它一定是全新的。
$> find .git/objects -type f | wc -l # if this prints 0, then it's brand spankin' new.
关于git - 如何判断git仓库是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8874526/