git - 如何判断git仓库是否为空

标签 git

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/

相关文章:

git - 使用来自多个站点的 Git 子树 merge

git - 有什么办法可以将配置文件自动备份到 github 吗?

GitKraken 没有显示我是贡献者的 repo 协议(protocol)

python - 通过python在git中自动提交

git - 如何在暂存环境中使用 git flow?

git - 如何将我的应用程序上传到 github 但删除敏感的授权信息?

由于断言错误 "svn_fspath__is_canonical(child_fspath)"(cygwin),git svn dcommit 失败

git - Jgitver maven 插件 : Always calculates -SNAPSHOT versions on tagged commits

每个作者在所有分支上的 Git 提交数

git - 更改特定项目中的 git 帐户