How to see Git's working log (not commit history, But Git's process)

老子叫甜甜 提交于 2021-01-01 08:22:32

问题


I am trying to do Git work in vscode's ssh remote control to another windows machine. Other stuff jobs are not problems. (like editing, compiling...) But When I tried to push/pull/fetch, git didn't respond anything. It seems like being pending by something. So I want to see specific steps to turn out what is a problem.

Note: Log, show... commands are working correctly. When I am working in the machine directly, this problem doesn't occur.


回答1:


You can set environment variables as defined in the documentation in the Debugging section here

GIT_TRACE controls general traces, which don’t fit into any specific category. This includes the expansion of aliases, and delegation to other sub-programs.

In the terminal you could set this variable GIT_TRACE to 1 and run your git command. In Windows you can do set GIT_TRACE=1 and in linux environment you can do export GIT_TRACE=1

In addition to this if you would like to see verbose output of the network related operations in git which involves curl, you can use set this environment variable GIT_CURL_VERBOSE.

Networking

Git uses the curl library to do network operations over HTTP, so GIT_CURL_VERBOSE tells Git to emit all the messages generated by that library. This is similar to doing curl -v on the command line.




回答2:


Better than GIT_TRACE, you have since Git 2.25 the variable GIT_TRACE2, and git fetch has been instrumented to emit traces

 # Windows
 set GIT_TRACE2_EVENT=1

 # Linux
 export GIT_TRACE2_EVENT=1

 # launch VSCode



回答3:


Not sure if you are exactly looking for this but it may help.

I would recommend using a different format than the default. My usual choice is summary with the graph, but one line summary alone usually does the trick.

Option 1: One line summary w/ Graph

git log --pretty=format:'%h : %s' --graph > log.log

Results in:

* 2d3acf9 : ignore errors from SIGCHLD on trap
*   5e3ee11 : Merge branch 'master' of git://github.com/dustin/grit
|\  
| * 420eac9 : Added a method for getting the current branch.
* | 30e367c : timeout code and tests
* | 5a09431 : add timeout protection to grit
* | e1193f8 : support for heads with slashes in them
|/  
* d6016bc : require time for xmlschema

Option 2: One line summary w/o Graph

git log --pretty=format:'%h was %an, %ar, message: %s' > log.log

Results in:

a6b444f was Scott Chacon, 5 days ago, message: dammit, this is the second time this has re
49d77f7 was Scott Chacon, 8 days ago, message: modified index to create refs/heads if it i
9764edd was Hans Engel, 11 days ago, message: Add diff-lcs dependency
e1ba1e3 was Hans Engel, 11 days ago, message: Add dependency for Open4
0f87b4d was Scott Chacon, 12 days ago, message: merged recent changes

You can find more formatting options in the docs here



来源:https://stackoverflow.com/questions/61313975/how-to-see-gits-working-log-not-commit-history-but-gits-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!