Search code examples
gitdebuggingverbosity

Does Git have a debug or verbose option explaining what it is doing?


Do some or all git commands have debug or verbose options which explain what they are attempting or what other sub-commands are being executed?


Solution

  • This question is already answered. Please have a look How can I debug git/git-shell related problems?

    To answer your question and give a quick reference, yes, there are! The following environment variables that are present in git:

    GIT_SSH, GIT_TRACE, GIT_FLUSH, GIT_TRACE_PACK_ACCESS, GIT_TRACE_PACKET, GIT_TRACE_PERFORMANCE, GIT_TRACE_SETUP, GIT_CURL_VERBOSE, GIT_REFLOG_ACTION, GIT_NAMESPACE, GIT_DIFF_OPTS, GIT_EXTERNAL_DIFF, GIT_DIFF_PATH_COUNTER, GIT_DIFF_PATH_TOTAL, GIT_MERGE_VERBOSITY.

    Usage:

    Method 1: Just prepending the environment variables before the command: GIT_TRACE=1 GIT_CURL_VERBOSE=1 git YourCommandHere

    Method 2: set -i; GIT_TRACE=2 GIT_CURL_VERBOSE=2 GIT_TRACE_PERFORMANCE=2 GIT_TRACE_PACK_ACCESS=2 GIT_TRACE_PACKET=2 GIT_TRACE_PACKFILE=2 GIT_TRACE_SETUP=2 GIT_TRACE_SHALLOW=2 git YourCommandHere -v -v; set +i

    Also, you can have a look Git Environment Variables.