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

前端 未结 4 1395
庸人自扰
庸人自扰 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:44

    Use git -C rev-parse. It will return 0 if the directory at is a git repository and an error code otherwise.

提交回复
热议问题