可以使用以下命令查看目录是否关联到git仓库:
$ cd /path/to/directory $ git status
如果目录已经关联到git仓库,会显示类似以下信息:
On branch master Your branch is up-to-date with 'origin/master'. nothing to commit, working tree clean
如果目录未关联到git仓库,会显示如下信息:
fatal: Not a git repository (or any of the parent directories): .git