问题描述
我试图在我处于不同的目录时调用 git log
。我通过 .git
的位置
git log / Users /徕卡/ proj1
但它表示不是git回购。如果我 cd
进入这个目录,它就可以正常工作了
cd / Users / Leica / Proj1
git log
这对我来说不是很清楚。 那么我做错了什么? 这就是git的工作原理。它希望从工作副本内部运行(不一定是根源)。 如果您真的必须这样做(但为什么?),您可以做 log命令的path选项是指存储库中的文件路径 (植根于存储库根,而不是你的文件系统根目录)。它将日志的输出限制为与这些文件相关的提交。 I am trying to call but it says "not a git repo". If I Which is not clear to me. The So what am I doing wrong? That's just how git works. It wants to be run from inside the working copy (does not have to be at its root). If you really must do this (but why?), you could do The "path" option of the log command refers to file paths within the repository (rooted at the repository root, not your file system root). It limits the output of the log to commits relevant to those files. 这篇关于除非我在项目目录中,否则Git不会显示日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! git log
b
$ b $ g $ log $ [$] ; ...]
$ git --git-dir = / Users / Leica / proj1 / .git log
git log
while I'm in a different directory. I pass the location where the .git
isgit log /Users/Leica/proj1
cd
into this directory, it works finecd /Users/Leica/Proj1
git log
git log
documentation says$ git --git-dir=/Users/Leica/proj1/.git log