【问题标题】:Is there any command that gets triggered on change in git branch?是否有任何命令会在 git 分支更改时触发?
【发布时间】:2022-08-17 14:05:49
【问题描述】:

例如,当我们更改文档时,vscode.workspace.onDidChangeTextDocument 被触发,或者当我们从一个文件转到另一个文件时,vscode.window.onDidChangeActiveTextEditor 被触发。是否有任何命令被触发或任何方法来确定分支是否已更改?

标签: git visual-studio-code vscode-extensions


【解决方案1】:

the git extension API type definitions file

这个 API 点看起来与您正在寻找的内容特别相关:

export interface RepositoryState {
    readonly HEAD: Branch | undefined;
    readonly refs: Ref[];
    readonly remotes: Remote[];
    readonly submodules: Submodule[];
    readonly rebaseCommit: Commit | undefined;

    readonly mergeChanges: Change[];
    readonly indexChanges: Change[];
    readonly workingTreeChanges: Change[];

    readonly onDidChange: Event<void>;
}

这不是一个完整的答案,但是如果您知道如何完成它,请对其进行编辑或创建一个。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-31
    • 1970-01-01
    • 1970-01-01
    • 2021-10-27
    • 2018-05-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多