8

In vscode Source Control pane, I would like to get a log of the commands of any applied git command of the running session, including all mouse-click actions.

For example:

Before "Initialize Repository":

before "Initialize Repository"

After "Initialize Repository", which should log the git init command:

after "Initialize Repository"

And so on.

questionto42
  • 7,175
  • 4
  • 57
  • 90
  • 3
    By `protocol` do you mean log the commands? Or their output? This should be available in the `Output` pane if you select `Git` instead of `Tasks` from its toolbar – Panagiotis Kanavos Jul 07 '20 at 17:00

2 Answers2

10

The Git Output is available in the Output pane if you select Git instead of Tasks from its toolbar.

You get the same result through ["Source Control" > 3 dots [...] > "Show Git Output"].

(This quotes @PanagiotisKanavos's comment who has not answered after request.)

questionto42
  • 7,175
  • 4
  • 57
  • 90
  • 2
    Is this also saved anywhere? – sam Jan 15 '21 at 13:33
  • @sam Try [In Visual Studio Code, is there a way to get a merged git log of all git commands from both Source Control pane and Terminal window?](https://stackoverflow.com/a/63075242/11154841), I think I should have collected anything there that is saved of the git actions in vscode. Most probably, you will need the mere "history" command, though, mind, you lose that terminal history when you close vscode. – questionto42 Jan 15 '21 at 13:41
  • Thank you. is there no log file for this? – Jovylle Sep 16 '21 at 01:29
  • 1
    @JovylleBermudez There are various log files. I am not sure whether one of them is exactly the output of the vscode button-click answer here, perhaps it is "git.txt", but unlikely. If you do not find such a log as you see it by button-click in vscode it is probably queried on the run from the "vscode Developer Tools console", with no compact file behind. Have a look at [In Visual Studio Code, is there a way to get a merged git log of all git commands from both Source Control pane and Terminal window?](https://stackoverflow.com/a/63075242/11154841) to see any git logs / traces in one overview. – questionto42 Sep 16 '21 at 11:32
3

VSCode 1.64 (Q1 2022) will improve the Git Output pane, by adding timestamp.

Issue 129334 mentioned:

The data emitted into the "Output" windows by the git feature (built-in extension) does not feature timestamps.

This makes it difficult to correlate "challenges" with git activity. The ">" shown in the output does not appear to add a lot of value, timestamps would, an indication whether an activity was initiated and completed, too.

This is fixed by issue 138168 and commit 452e2c5 "Add timestamp and execution time to Git log".

Tomorrow's Insiders build will contain both timestamps, as well as execution time of the git command.


VSCode 1.65 (Feb. 2022) will actually be able to record the git command itself.

Git command output logging

When executing a Git command, the contents of stderr are logged in the Git output window.

This milestone we have added a new setting, git.commandsToLog, that can be used to specify a list of Git commands that will have the contents of stdout logged in the Git output window.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 2
    Thanks for mentioning `git.commandsToLog`, the output is really important when diagnosing why git commands are slow. – Monsignor Jun 08 '22 at 04:54