In a git hook is the current working directory guaranteed to be within the git repository?

前端 未结 3 866
日久生厌
日久生厌 2020-12-14 05:17

Experimentally it seems that git hooks get run with the current directory set to be the root of the repository. However, I can\'t see any guarantee about that in the git doc

3条回答
  •  囚心锁ツ
    2020-12-14 06:03

    You can use the environment variable $GIT_DIR. $GIT_DIR points at the .git directory.

提交回复
热议问题