在 Visual Studio Code 中,有没有办法从源代码管理窗格和终端窗口中获​​取所有 git 命令的合并 git 日志? [英] 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?

查看:113
本文介绍了在 Visual Studio Code 中,有没有办法从源代码管理窗格和终端窗口中获​​取所有 git 命令的合并 git 日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是

This is a spin-off from In Visual Studio Code, how can I get a git log of all git commands executed in the Source Control pane?

问题是如何获取源代码管理"窗格(链接已说明)与终端"窗口的日志的合并日志.最好的命令及其输出,最重要的是命令的顺序.

The question is how to get a merged log of the Source Control pane (that the link already explains) with the log of the Terminal window. At best commands + their output, most important is the sequence of the commands.

推荐答案

我希望vscode提供一个现成的合并日志.相反,到目前为止,似乎还需要手工作业.

I expected vscode to offer a ready-made merged log. Instead, up to now, manual work seems needed.

源代码管理"窗格终端视图中唯一自动合并的日志位于vscode开发者工具"中.>控制台",但要注意的是,不会直接记录终端命令:您只能从某个结构中看到当时有一个终端命令,然后您至少可以手动在终端历史记录中查找它必须具备的内容一直很棘手,但是如果您迫切需要记录或重构确切的命令序列,这并非没有可能.仍然需要手动操作才能将终端命令分配到Developer Tools控制台日志中的正确位置.

The only automatically merged log of Source Control pane and Terminal view is in the vscode "Developer Tools" > "console", with the caveat that the terminal commands are not logged directly: you only see from a certain structure that there was a terminal command at that moment and then you can at least manually look up in your terminal history what it must have been - tricky, but not impossible if you desparately need to document or reconstruct the exact command sequence. Still you need the manual work here to assign the terminal commands to the right place in the Developer Tools console log.

还有其他两个日志都不包括这两个日志,只是源代码管理"窗格或终端"视图.

There are other logs which do not include both, just either the Source Control pane or the Terminal view.

最简单的手动合并日志显然是Git Output窗口的手动合并(请参见)与终端命令+输出中的简单副本手动组合在一起.

The easiest manually merged log is obviously the manual merger of the Git Output window (see In Visual Studio Code, how can I get a git log of all git commands executed in the Source Control pane?) manually put together with simple copies from the terminal commands+output.

为了完整起见,还有其他一些日志不增加任何值,例如:终端窗口中的 git reflog ,git.txt和 history 命令.

There are other logs available which do not add any more value, for completeness: git reflog, git.txt, and history command in Terminal window.

这里是详细的文档,由于手动合并git log和terminal log应该是最简单的方法,因此可能会被忽略.

Here is a detailed documentation which can probably be ignored because the manual merge of git log and terminal log should be the easiest way.

####

vscode开发人员工具控制台:

  • 运行""C:\ Users \ USER \ AppData \ Local \ Programs \ Microsoft VS Code \ Code.exe"--verbose,或者如果它在您的Path中,只需从命令行运行 code --verbose`.

  • run "C:\Users\USER\AppData\Local\Programs\Microsoft VS Code\Code.exe" --verbose or if it is in your Path just run code --verbose` from the command line.

在代码中选择 Help |切换开发人员工具,然后选择控制台

in Code select Help | Toggle Developer Tools and select the Console

找出所需的过滤器,例如第一次测试的文件名,或者如果您只想查看源代码管理"窗格的命令,请过滤"CommandService".您需要四处寻找发现,也许您只是复制整个日志并稍后对其进行过滤.

Find out which filters you need, e.g. a filename for a first test, or if you want to see only the Source Control pane commands, filter for "CommandService". You need to play around to find out, perhaps you just copy the whole log and filter it later.

示例:在git -Watcher"上设置过滤器,搜索init";给我:

Example: put a filter on "git -Watcher", search for "init" gives me:

TRACE遥测/views.welcomeAction {viewId:"workbench.scm",uri:

TRACE telemetry/views.welcomeAction {viewId: "workbench.scm", uri:

"命令: git.init ?%5Btrue%5D"}}

"command:git.init?%5Btrue%5D"}

TRACE CommandService#executeCommand

TRACE CommandService#executeCommand

git.init

vscode使用git.stage而不是git.add(这是同义词),请参见

vscode uses git.stage instead of git.add, which are synonyms, see Differencies between git add and git stage command

搜索项目文件会导致"DecorationsService"git.commit之后.

The search for a project file leads to the "DecorationsService" after the git.commit.

终端命令无法直接看到,但是您可以从类型信息"中看到.在终端中,终端中有输入 :

TRACE IPty#write [数字]个字符

TRACE IPty#write [number] characters

后跟4个文件监视程序"操作(已通过 git status 测试).

followed by 4 "File Watcher" actions (tested with git status).

尽管您看不到命令​​,但是即使在源代码管理"窗格和终端"窗口之间切换,也可以重新构造它们的顺序.

Though you cannot see the commands, you can reconstruct their sequence even when you have switched between Source Control pane and Terminal window.

请注意,与保存的 git reflog 相比,这只是一个会话日志.而且它不包含任何输出.

Mind that this is just a session log in contrast to the saved git reflog. And it does not include any output.

####

git reflog:

对于全局解决方案,存在 git reflog ,该日志仅具有commit/checkout/merge…日志,并且没有显示确切的命令/输出,但是摘要,它是从在Git中执行的命令的历史记录或日志

For a global solution, there is the git reflog which has only commit/checkout/merge… log and does not show the exact command / output, but a summary, this is borrowed from History or log of commands executed in Git

####

git.txt:

vscode在Windows上提供了一个git日志,这是 C:\ Users \ USER \ AppData \ Roaming \ Code \ logs \ [some hash] \ git.txt

vscode offers a git log, on Windows, this is C:\Users\USER\AppData\Roaming\Code\logs\[some hash]\git.txt

有关更多详细信息和其他位置,请参见此处是Visual Studio Code日志文件?

For more details and other locations, see Where are Visual Studio Code log files?

开始像

遥测/git.command {属性":{"command":"git.init"…

telemetry/git.command {"properties":{"command":"git.init" …

####

终端历史记录:

对于命令的终端历史记录,请在vscode终端中使用 history ,这是从

For the terminal history of commands, use history in the vscode terminal, this is borrowed again from History or log of commands executed in Git

与保存的 git reflog 相比,这只是一个会话日志.

This is just a session log in contrast to the saved git reflog.

这篇关于在 Visual Studio Code 中,有没有办法从源代码管理窗格和终端窗口中获​​取所有 git 命令的合并 git 日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆