le·git (beta)
le·git noun, French: the git - a legit Git client for VSCode
A keyboard driven client for accessing Git’s most used commands. More delicious than a baguette.
Table of contents
Beta disclaimer
le·git is currently in beta, and currently only supports OSX. Default keybindings are subject to change. Questions and feedback can be left on the VSCode Marketplace page. See below for future roadmap features.
Setup
le·git strives to work with any keybindings, whether you use vanilla VSCode, Vim, or Emacs keybindings. In some cases some manual configuration is required.
Usage with VSCode Vim
If you are using VSCode Vim, you can add the following to your keybindings configuration. These changes will not affect any Vim keybindings outside of le·git.
In your keybindings.json
config, add:
{
"command": "legit.expand",
"key": "tab",
"when": "editorTextFocus && resourceScheme == 'legit' && vim.mode != 'CommandlineInProgress' && vim.mode != 'SearchInProgressMode'"
}
Using VSCode for commit messages
If you want to use VSCode to enter a full length commit message when typing c c
, you must have the integrated terminal command installed. You can do this by opening the command palette and running the Shell Command: Install 'code' command in PATH
Using with custom themes
If you are using a custom theme, and are not seeing colorized diffs, you can add the following to your settings.json
"editor.tokenColorCustomizations": {
"textMateRules": [{
"scope": "markup.deleted.diff",
"settings": {
"foreground": "#F92672"
}
}, {
"scope": "markup.inserted.diff",
"settings": {
"foreground": "#A6E22E"
}
}],
}
To see what other scopes are available for customization, you can launch Developer: Inspect TM Scopes
from the command palette to see which scopes are being used for various content in the status window.
Keybindings
Basic keybindings
Command |
Key |
Description |
Launch |
alt+l g |
Launch le·git status window |
Fetch |
f f |
Fetch from the current remote |
Expand section |
tab |
Toggle expand/collapse section/file under cursor |
Stage |
s s |
Stage the file or hunk under the cursor |
Unstage |
u u |
Unstage the file or hunk under the cursor |
Commit message |
c m |
Commit the currently staged changes with a message (opens quick dialog) |
Push Upstream |
P u |
Push the current branch to the current upstream (creates one if it doesn't exist) |
All keybindings
See all keybindings
General
Command |
Key |
Description |
Launch |
alt+l g |
Launch le·git status window |
Refresh |
cmd+r |
Refresh the current status |
Switch workspace |
w w |
Switch repositories (when vscode workspace contains multiple folders) |
Status and changes
Command |
Key |
Description |
Expand section |
tab |
Toggle expand/collapse section under cursor |
Open |
enter |
Open item (file, stash, commit, etc) under cursor |
Open to the right |
alt+enter |
Open item (file, stash, commit, etc) under cursor to the right of the status pane |
Open to the right without focus |
shift+enter |
Open item (file, stash, commit, etc) under cursor to the right of the status pane without taking focus away |
Close |
q q |
Close the current status or diff window |
Stage |
s s |
Stage the file or hunk under the cursor |
Unstage |
u u |
Unstage the file or hunk under the cursor |
Discard |
x x |
Discard changes to the file under the cursor |
Commit |
c c |
Commit the currently staged changes (opens default configured commit editor) |
Commit amend |
c a |
Amend the last commit |
Commit message |
c m |
Commit the currently staged changes with a message (opens quick dialog) |
Expand Diff Context |
d + |
Expand the number of context lines displayed diff hunks |
Shrink Diff Context |
d - |
Shrink the number of context lines displayed around diff hunks |
Stash |
z z |
Stash current changes |
Stash pop |
z p |
Pop the last stash |
Stash apply |
z a |
Apply the last stash |
Stash drop |
z d |
Drop a stash with the given index |
Working with branches
Command |
Key |
Description |
Create branch |
b c |
Create a new branch |
Merge |
m m |
Merge a branch into the current branch |
Merge --no-ff |
m n |
Merge a branch into the current branch, preventing fast-forward |
Merge --ff-only |
m f |
Merge a branch into the current branch, fast-forward only |
Rebase Upstream |
r u |
Rebase the current branch against it's current upstream |
Rebase Elsewhere |
r e |
Rebase the current branch against another branch |
Rebase Continue |
r c |
Restart the rebasing process after having resolved a merge conflict |
Rebase Abort |
r a |
Abort the rebase operation and reset HEAD to the original branch |
Collaboration
Command |
Key |
Description |
Fetch |
f f |
Fetch from the current remote |
Fetch prune |
f p |
Fetch from the current remote and prune local branches |
Push Upstream |
P u |
Push the current branch to the current upstream (creates one if it doesn't exist) |
Force Push Upstream |
P f |
Force push the current branch to the current upstream |
Push HEAD |
P h |
Push the current HEAD to the current remote |
History
Command |
Key |
Description |
Log graph |
alt+l l |
Display the Git log graph |
Motivations
VSCode's ease of configuration and rich ecosystem of extensions has been drawing many long time Vim and Emacs users to make the switch. However, such users expect the advanced keyboard navigability that Vim and Emacs have to offer. While VSCode comes bundled with a great Git extension already, it's keyboard navigability is lacking. Most Emacs users are familiar with, and swear by Magit as being the ultimate Git client. Since the lack of a comparable tool in VSCode often prevents users from making the jump, this extension aims to fill that gap.
Future plans
1.0 Roadmap
In no particular order...
- Windows/Linux support
- Better error notifications
- Branch operations
- Delete
- Delete remote
- Delete local merged branches
- List
- Pull/pull --rebase
- Add/remove/change upstream
- File history
- Git log/graph mode
- Reset/reset --hard to commit
- Interactive rebase
- Show commit
- Cherry pick
- Colorization
- Tagging
- Help mode
- Performance enhancements
- Reflog mode
- SSH key password entry
- Better conflict resolution