在 Visual Studio 代码中,如何获取在源代码管理窗格中执行的所有 git 命令的 git 日志?

In Visual Studio Code, how can I get a git log of all git commands executed in the Source Control pane?

在 vscode 源代码管理窗格中,我想获取 运行 会话的任何已应用 git 命令的命令日志,包括所有鼠标单击操作。

例如:

在“初始化存储库”之前:

在“Initialize Repository”之后,应该记录 git init 命令:

以此类推

Git OutputOutput 窗格中可用,如果您从其工具栏 select Git 而不是 Tasks

您通过 ["Source Control" > 3 dots [...] > "Show Git Output"] 得到相同的结果。

(这里引用@PanagiotisKanavos 的评论,请求后未回复。)

VSCode 1.64(2022 年第一季度)将通过添加时间戳改进 Git 输出窗格。

Issue 129334提到:

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.

这由 issue 138168 and commit 452e2c5“将时间戳和执行时间添加到 Git 日志”修复。

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


VSCode 1.65(2022 年 2 月)实际上将能够记录 git 命令本身。

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.