IdeaGitTool
English | 简体中文
IntelliJ's Git workflow, in VS Code.
If you came to VS Code from a JetBrains IDE and miss its Git tools, this brings them over with the same menus, wording and shortcuts. It re-creates the UI of Rebased, the standalone client built on the IntelliJ platform, and runs next to VS Code's built-in Git. It follows your VS Code theme by default, or can use the IntelliJ New UI look.
Why use it
- Resolve conflicts in a three-pane merge window. When a merge, rebase or cherry-pick stops, the Conflicts dialog opens right away: Yours, an editable Result and Theirs side by side, and a single action to resolve all simple conflicts.
- Edit history from the log. Right-click commits in the graph to fixup, squash, drop, reword or start an interactive rebase.
- Commit the files you checked. There is no staging area to manage. Changelists and the shelf keep separate pieces of work apart.
Installation
code --install-extension ideagittool.ideagittool
Or search for IdeaGitTool in the Extensions view, or use the Marketplace page. VS Code updates the extension automatically when a new version is published.
Requirements: VS Code 1.90 or later, and Git 2.25 or later on your PATH (or set ideagittool.gitPath). The log actions that edit commits without touching the working tree (Drop / Extract Selected Changes, Add Commits to Remote Branch) need Git 2.40 or later, and the --update-refs rebase option needs Git 2.38 or later.
From the .vsix package
- Download
ideagittool-0.4.3.vsixfrom thereleases/folder of this repository. - Install it in one of these ways:
⋯ menu at the top, choose Install from VSIX… and select the file.
- Or from a terminal:
code --install-extension ideagittool-0.4.3.vsix
- Reload the window if VS Code asks you to.
From source
git clone https://github.com/PGshen/vs-idea-gittool.git
cd vs-idea-gittool
npm install
npm run package # builds ideagittool-<version>.vsix
code --install-extension ideagittool-*.vsix
First steps
- Open a folder that contains a Git repository. The Git log opens in the Git panel at the bottom, and the IdeaGitTool icon appears in the activity bar (Commit / Shelf / Stash / Branches).
- The Branches tab (Ctrl+Shift+
) holds IntelliJ's branches popup: Update Project…, Commit…, Push…, New Branch…, and every local and remote branch and tag with its actions. - IdeaGitTool works next to VS Code's built-in Git extension; nothing has to be disabled.
- IntelliJ shortcuts are on by default and replace some VS Code shortcuts (for example Ctrl+T). Turn off ideagittool.intellijShortcuts
to keep the VS Code ones (see Settings).
Features
Git log (in the Git panel at the bottom; ideagittool.log.showInEditor opens it in the editor, like Rebased)
ideagittool.inlineBlame.enabled, command Toggle Inline Git Blame).
resolved/total badges, inline Accept buttons, Accept ‘Yours’ / ‘Theirs’ and Revert Conflict Resolution in the context menu, Resolve All Simple Conflicts with its status, Group by directory, Close / Accept and Finish / Resolve Manually (Review Changes). Partially merged files are saved by the merge window's Save and Close and continue where they were left when reopened; files are marked resolved in git by Accept and Finish.
ideagittool.merge.contextLines), Apply Non-Conflicting Changes (Left / All / Right), Resolve Simple Conflicts, Revert Conflict Resolution, Compare Contents, F7 / Shift+F7, undo, Accept Left / Accept Right / Save and Close / Apply Changes. CRLF and the final newline are kept. Binary and deleted/modified conflicts get a simple Accept Left / Accept Right choice. Set ideagittool.merge.useVsCodeMergeEditor to use VS Code's merge editor instead.
), laid out like IntelliJ's branches popup: search field ("Search for branches and actions", matches highlighted) with Fetch and settings (Group by Directory, Show Recent Branches, Show Tags, …); Update Project…, Commit…, Push…, the Abort / Continue actions of an ongoing merge or rebase, New Branch…, Checkout Tag or Revision…; then Recent / Local / Remote / Tags grouped by directory, with the current branch, favorites (click the star), incoming / outgoing counts and a
Toolbar and operations
› that opens the branch actions (Checkout, New Branch from, Checkout and Rebase, Compare, Show Diff with Working Tree, Rebase onto, Merge into, Pull using Rebase/Merge, Update, Push, Rename, Delete, …). Double-click checks a branch out; smart checkout when local changes are in the way.
IdeaGitTool: Git Menu…) and VCS Operations Popup (Alt+).Settings
- ideagittool.appearance
:vscode(the default) draws every view and dialog like native VS Code: buttons, inputs, checkboxes, lists, menus, hovers, scrollbars, fonts and colors come from your VS Code theme, and monochrome icons take the theme's icon color.intellijkeeps the IntelliJ New UI look (IntelliJ light/dark palette and widget shapes). The layout and the features are the same in both;scripts/layout-check.mjsverifies that no element moves. - ideagittool.language
(defaultsystem): choosesystemto follow VS Code's display language, or explicitly useenorzh-cn. Reload the window after changing this setting. This controls IdeaGitTool views, dialogs, and notifications; labels contributed to the VS Code menus and Settings editor continue to follow VS Code's display language. - ideagittool.log.showInEditor
,ideagittool.log.openOnStartup,ideagittool.commit.gpgSign,ideagittool.commit.skipHooks,ideagittool.updateMethod,ideagittool.push.,ideagittool.annotate.,ideagittool.branches.*. Open the Settings editor and search for "ideagittool" to see all of them. - ideagittool.inlineBlame.enabled
(default on): show the blame of the caret line at the end of the line. It is hidden while Annotate with Git Blame is on. - ideagittool.merge.handleConflicts
(askby default): on the first conflict in a workspace IdeaGitTool asks once whether it should handle conflicts instead of VS Code's built-in conflict UI. If you agree (or setalways), it turns offmerge-conflict.codeLens.enabled,merge-conflict.decorators.enabledand, when you turned it on,git.mergeEditorin your user settings.neverleaves VS Code's settings alone; they are never changed without your consent. Restore VS Code's Built-in Merge Conflict UI puts the previous values back. VS Code's own Resolve in Merge Editor button (git extension) cannot be hidden by a setting. - ideagittool.dialogs.openInNewWindow
(default off): open dialogs and the merge window in their own window, like IntelliJ's floating dialogs, instead of an editor tab. The window closes with the dialog. - ideagittool.intellijShortcuts
(default on): Ctrl+T Update Project, Ctrl+Shift+K Push, Ctrl+Shift+Branches, Alt+VCS Operations Popup, Ctrl+Alt+N New Branch, Alt+9 Git log, Ctrl+K Commit (only while the Commit view has focus, everywhere withideagittool.intellijShortcutsInEditor). These replace the VS Code defaults on the same keys (for example Ctrl+T Go to Symbol in Workspace and Ctrl+Shift+New Terminal). Turn the setting off to keep the VS Code shortcuts.
Differences from Rebased
An extension cannot draw floating popups over the VS Code workbench or add menus to the gutter, so:
- Dialogs open as editor tabs that look like IntelliJ dialogs. With
ideagittool.dialogs.openInNewWindowthey open in their own window instead (VS Code chooses its size and position, and it is not modal). The branches popup is the Branches tab of the Commit tool window, and the actions of the toolbar (Update Project, Push, branch widget) are there too instead of in the status bar. - Diffs use the VS Code diff editor; merges use an IntelliJ-style three-pane merge window built on CodeMirror.
- Annotation options live in the hover and the line-number context menu.
- In a workspace with several repositories, file history and branch comparison show one repository (as in IntelliJ), and the combined log orders commits by date.
- With synchronous branch control, branch submenu labels use the first repository's current branch name.
- Linearize Merges is not offered (IntelliJ shows it only behind an internal registry flag).
- Opening a worktree always uses a new window.
Development
npm install
npm run build # merges contrib/*.json into package.json and bundles dist/
npm test # node:test, incl. real git operations on temporary repositories
npm run typecheck
npm run package # builds ideagittool-<version>.vsix
node scripts/preview.mjs <bundle> test/fixtures/<x>.mjs out.png [--light | --vscode=dark|light] # render a webview with a mocked host
node scripts/layout-check.mjs [--base=<ref>] # element boxes must not move against <ref>
sh scripts/preview-vscode.sh <dir> dark|light # screenshots of the main views in the VS Code look
xvfb-run -a node scripts/e2e.mjs test/e2e-log.mjs # run a scenario in real VS Code
Packaging
Requires Node.js 20 or later (needed by @vscode/vsce) and npm.
npm install # once, installs the build tools (esbuild, TypeScript, vsce)
npm test # optional: unit tests before packaging
npm run package # builds ideagittool-<version>.vsix in the repository root
npm run package merges contrib/*.json into package.json, bundles src/ into dist/ with minification, and runs
vsce package. The version in the file name comes from "version" in package.json.
To publish a new version:
- Change
"version"inpackage.jsonand add an entry toCHANGELOG.md. - Run
npm run package. - Copy the result to
releases/(the only place where.vsixfiles are committed):
cp ideagittool-<version>.vsix releases/
- Commit, then tag the release:
git tag -a vand-m "IdeaGitTool " git push origin v.
code --install-extension ideagittool-.vsix (see Installation).
See ARCHITECTURE.md for the code layout.
License
Apache 2.0. The UI icons are from the IntelliJ Platform, see the NOTICE file; the extension logo is original.