Check if directory is git repository (without having to cd into it)

前端 未结 4 1405
庸人自扰
庸人自扰 2021-02-18 12:51

What\'s a shell command I can use to, using the full directory path, determine whether or not a given directory is a git repository? Specifically, I\'d like to be able to do thi

4条回答
  •  一整个雨季
    2021-02-18 13:39

    We can also try git status command and if the output is like :

    fatal: Not a git repository (or any of the parent directories): .git

    Then, the directory is not a git repository.

提交回复
热议问题