gitgithubgithub-apigithub-api-v3

which REST API git client is calling


I wonder, if there is a way to know which API git client is calling for the command?

For example, how to tell which API git client is calling for git log. Is there any generic way of discovering this?


Solution

  • You can activate the Git Trace2 API in order to see what is going on during a git log call, or any other commands:

    Example (for git version)

    export GIT_TRACE2=~/log.normal
    $ git version
    git version 2.20.1.155.g426c96fcdb
    
    $ cat ~/log.normal
    12:28:42.620009 common-main.c:38                  version 2.20.1.155.g426c96fcdb
    12:28:42.620989 common-main.c:39                  start git version
    12:28:42.621101 git.c:432                         cmd_name version (version)
    12:28:42.621215 git.c:662                         exit elapsed:0.001227 code:0
    12:28:42.621250 trace2/tr2_tgt_normal.c:124       atexit elapsed:0.001265 code:0
    

    The trace2 API was introduced with Git 2.22 (Q2 2019).