Use git “log” command in another folder

前端 未结 2 1315
长情又很酷
长情又很酷 2020-11-28 05:37

I have some php files in a Folder A (which is a git project). In these php file I want to execute \"git log\" but for the folder B. Folder B is another git project (so log i

2条回答
  •  难免孤独
    2020-11-28 05:46

    From, man git:

    You can do this with the --git-dir parameter, before passing any commands.

    git --git-dir /foo/bar/.git log
    

    (Specifying the .git directory is necessary.) From the documentation:

    --git-dir=

    Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.

提交回复
热议问题