使用git“log”命令在另一个文件夹 [英] Use git "log" command in another folder
问题描述
我在Folder A中有一些php文件(这是一个git项目)。在这些php文件中,我想执行git log,但对于文件夹B.文件夹B是另一个git项目(因此A和B之间的日志不同)。
如何用shell命令做到这一点?
从 man git
:
在传递任何命令之前,您可以使用 - git-dir
参数来执行此操作。
git --git-dir /foo/bar/.git log
$ (必须指定
.git
>目录。)从文档:
- git-dir =< path>
设置存储库的路径。这也可以通过设置
GIT_DIR
环境变量来控制。它可以是当前工作目录的绝对路径或相对路径。
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 is different between A and B).
How I can do that with shell command ?
解决方案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=<path>
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.
这篇关于使用git“log”命令在另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!