开发者

Git Log Displays Nothing

I have a number of git repositories (with commits) and each displays nothing whe开发者_如何学编程n running git log. If I run the command outside a project directory (without a git repository) I get:

fatal: Not a git repository (or any of the parent directories): .git

I tried re-installing Git (I'm now running 1.7.5.4) and re-cloning my repositories to no avail. Any ideas?


git log does not show any commit!

I noticed that not only git log command but also man command does not show anything for me. It turned out that I just needed to set the PAGER environment variable to less or more programs to solve both problems.

export PAGER=less


I've just experienced the same problem, of git log not displaying anything for a particular file. The problem turned out to be Windows was displaying the directory name with an upper-case first letter, but git expected the first letter to be lower-case. So "git log Subdir/file.c" produced no errors and no output. Whereas "git log subdir/file.c" produced the expected revision history.


May be that the pager is not set up correctly with git.

Diagnostics:

git config core.pager

If it gives empty output or something unexpected, it may be the cause of the problem.

Solution

Try one of the following with xxx = more, less or other pager of choice:

git config core.pager xxx
git config --global core.pager xxx


The fatal error for running a git command outside a project directory is expected. Not getting any log messages at all for running git log is not.

Try running gitk to see if you can see the log history there.


If you do not have any commits, it would not show anything and error. Also, if you don't have a current commit in a bare repo, you can still show all commits in a repo with `git log --all'.

You can also see what branches you have with

git branch -a

then you can git checkout branchX. You would be able to get output from git log then - provided you have some commits there. If you have bare repos, you can't checkout.

Hope this helps.


I have the same problem (and "git diff" doesn't work either), I still do not know why but I workaround :

git rev-list --all --reverse

Or better (only 10 last commits with message information) :

git rev-list --all --max-count=10 --reverse --pretty


i had the similar issue with a log to a file. 1] get a list of your config files git config --list 2] check this entry core.filemode=false change it to true git config core.filemode true 3] check your files path in gitk 4] i had the wrong path. now it works. git log -- ./Documents/holdMe.txt


For those who still don't come up with solution: Check your firewall, mine (Comodo on windows10) was blocking Git\usr\bin\less.exe.

After removing it from blocked apps it worked fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜