使用git“log”命令在另一个文件夹 [英] Use git "log" command in another folder

查看:89
本文介绍了使用git“log”命令在另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆