edamagit

kaholeMIT活跃维护

把 Emacs Magit 那套高效的 Git 操作体验搬进 VSCode,用快捷键和状态面板完成提交、分支、暂存等操作,不用记一堆命令行。

Magit for VSCode

pre-0.6.19发布于 2021-08-05 20:40 UTC1,539star95fork同步于 2026-11-07 07:32 UTC

怎么上手

由 README 提炼,执行前请确认
在 VSCode 扩展市场安装 kahole.magit,或从 Open VSX 安装 kahole/magit
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 Emacs Magit 的键盘驱动 Git 操作搬进 VSCode,让你不离开编辑器完成提交、分支与变基

把 Emacs Magit 那套高效的 Git 操作体验搬进 VSCode,用快捷键和状态面板完成提交、分支、暂存等操作,不用记一堆命令行。

核心能力

  • 用 alt+x g 等快捷键打开 Magit Status 视图
  • 在状态视图中用单键完成 stage、commit、push、rebase 等操作
  • 支持 Forge 显示 GitHub 等平台的 PR 与 issue
  • 可自定义键位,兼容 VSCodeVim 的 evil-magit 风格绑定
  • 支持 monorepo 中向上查找父级 .git 目录

容易踩的坑

monorepo 中需设置 git.openRepositoryInParentFolders 为 always 才能识别父级 .git;与 VSCodeVim 同用时默认键位会冲突,需在 keybindings.json 中解除默认绑定;Forge 功能需在设置中开启 Forge-enabled 才会显示 PR 与 issue

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本pre-0.6.19
  1. pre-0.6.19performance testpre-release最新正式版2021-08-05 · 2021-08-05 20:40 UTC

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Keyboard driven Git interface

    Usage (Theme: Dracula)

    Usage

    VSCode CommandDefault shortcut
    Magit Statusalt+x g
    Magit File Popupalt+x alt+g
    Magit Dispatchalt+x ctrl+g
    Magit Help (when in status view)?

    > Magit in VSCode Command palette will show you all available Magit actions from where you are.

    Keybindings inside edamagit

    Popup and dwim commands
      A Cherry-pick      b Branch           c Commit
      d Diff             f Fetch            F Pull
      I Ignore           l Log              m Merge
      M Remote           P Push             r Rebase
      t Tag              V Revert           X Reset
      y Show Refs        z Stash            shift+1 Run
      shift+5 Worktree   o Submodules       shift+4 Process Log
    
    Applying changes
      a Apply          s Stage          u Unstage
      v Reverse        S Stage all      U Unstage all
      k Discard
    
    Essential commands
      g        refresh current buffer
      TAB      toggle section at point
      RET      visit thing at point
      shift+4  show git process view
      q        exit / close magit view
    
      ctrl+j Move cursor to next entity
      ctrl+k Move cursor to previous entity
    

    [ See also the edamagit tutorial ]


    Settings

    • Forge-enabled: Enable Forge functionality (show pull requests, issues, etc from e.g. Github)
    • Display-buffer-function: Choose which side for magit windows to open on.
    • Hide-status-sections: Hide listed sections from status view.
    • Quick-switch-enabled: Automatically confirm switch menu after enabling a switch (e.g. --force)

    Monorepo support

    When used in a monorepo, you need to make sure that the subdirectory can detect the parent's .git.

    {
      "git.openRepositoryInParentFolders": "always",
    }
    

    Vim support (VSCodeVim)

    All edamagit keybindings are customizable using VSCode's built-in keybindings.json.

    Below are bindings providing evil-magit / spacemacs like keybindings.

    The negative bindings, e.g. -magit.discard-at-point for key k, remove the default edamagit bindings and the collisions with the Vim extension.

    Open your keybindings.json and paste the following JSON snippet.

      {
         "key": "g g",
         "command": "cursorTop",
         "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      { "key": "g r",
         "command": "magit.refresh",
         "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      {
        "key": "tab",
        "command": "extension.vim_tab",
        "when": "editorTextFocus && vim.active && !inDebugRepl && vim.mode != 'Insert' && !inlineEditIsVisible && editorLangId != 'magit'"
      },
      {
        "key": "tab",
        "command": "-extension.vim_tab"
      },
      {
        "key": "x",
        "command": "magit.discard-at-point",
        "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      {
        "key": "k",
        "command": "-magit.discard-at-point"
      },
      {
        "key": "-",
        "command": "magit.reverse-at-point",
        "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      {
        "key": "v",
        "command": "-magit.reverse-at-point"
      },
      {
        "key": "shift+-",
        "command": "magit.reverting",
        "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      {
        "key": "shift+v",
        "command": "-magit.reverting"
      },
      {
        "key": "shift+o",
        "command": "magit.resetting",
        "when": "editorTextFocus && editorLangId == 'magit' && vim.mode =~ /^(?!SearchInProgressMode|CommandlineInProgress).*$/"
      },
      {
        "key": "shift+x",
        "command": "-magit.resetting"
      },
      {
        "key": "x",
        "command": "-magit.reset-mixed"
      },
      {
        "key": "ctrl+u x",
        "command": "-magit.reset-hard"
      }
    

    Roadmap

    Feature requests as well as issues are welcome

    Interface

    • More interactivity in second-tier views (commit view, stash view, etc)
    • Config menus

    Missing Git/Magit features

    Missing Forge features