DOSKEY shortcuts for Command Prompt (cmd.exe) and matching functions for PowerShell, inspired by common git plugin aliases. Aliases are not git config alias.* entries; they are shell-level commands (for example gs → git status).
- Git for Windows (or another install where
gitis on yourPATH). - For aliases such as
gsw,grt, andgrts, use a Git version that supports switch and restore (Git 2.23+).
You can clone this repository anywhere. Files are copied under your profile data so the path does not depend on the clone location.
-
Clone the repository.
-
Open PowerShell in the repo root and run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force .\scripts\install.ps1
You can also run
scripts\install.ps1by full path from any directory; it locatescmd\andpowershell\from the repo layout. -
Open a new Command Prompt or PowerShell tab (Windows Terminal counts).
scripts\install.ps1 does the following:
- Copies
cmd\aliases.cmdandpowershell\GitAliases.ps1to
%LOCALAPPDATA%\git-aliases-for-windows\ - Sets
HKCU\Software\Microsoft\Command Processor\AutoRunto thataliases.cmdusing REG_EXPAND_SZ (so%LOCALAPPDATA%expands whencmdstarts). - Appends a small marked block to your current host PowerShell profile (
$PROFILE) that dot-sourcesGitAliases.ps1from the same install folder.
Windows 11 / Windows Terminal: the default profile is often PowerShell. Without the profile block, only CMD would load aliases; use scripts\install.ps1 so both shells stay in sync.
Command Prompt: DOSKEY macros are meant for normal interactive typing at the cmd prompt. Some non-interactive cmd /c uses do not expand macros the same way; day-to-day use in Terminal or cmd.exe is unaffected.
From the repo root:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force
.\scripts\uninstall.ps1To also remove the copied files under %LOCALAPPDATA%\git-aliases-for-windows\:
.\scripts\uninstall.ps1 -RemoveFilescmd /D: skipsAutoRunfor that session.- PowerShell: built-in aliases such as
gandgcare removed whenGitAliases.ps1loads so the git shortcuts can take those names. - Child
cmdprocesses: a globalAutoRunruns whenevercmdstarts (including some scripted uses).aliases.cmdstays silent to avoid breakingfor /fand similar patterns. - Execution policy: use
-Scope ProcesswithBypassonly for the session where you runscripts\install.ps1/scripts\uninstall.ps1if your machine restricts scripts.
Every name should exist in both cmd\aliases.cmd and powershell\GitAliases.ps1 when you contribute.
| Alias | Command |
|---|---|
g |
git |
ga |
git add |
gaa |
git add --all |
gapa |
git add --patch |
gb |
git branch |
gba |
git branch -a |
gbd |
git branch -d |
gbl |
git blame -b -w |
gbnm |
git branch --no-merged |
gbr |
git branch --remote |
gbs |
git bisect |
gbsb |
git bisect bad |
gbsg |
git bisect good |
gbsr |
git bisect reset |
gbss |
git bisect start |
gc |
git commit -v |
gc! |
git commit -v --amend |
gca |
git commit -v -a |
gcan! |
git commit -v -a --no-edit --amend |
gcans! |
git commit -v -a -s --no-edit --amend |
gcam |
git commit -a -m |
gcsm |
git commit -s -m |
gcb |
git checkout -b |
gcf |
git config --list |
gcl |
git clone --recursive |
gclean |
git clean -fd |
gpristine |
git reset --hard then git clean -dfx |
gcm |
git checkout master |
gcd |
git checkout develop |
gcmsg |
git commit -m |
gco |
git checkout |
gcount |
git shortlog -sn |
gd |
git diff |
gi |
git init |
gm |
git merge |
glog |
git log --oneline --decorate --color --graph |
ggpull |
git pull |
gl |
git pull |
ggpush |
git push |
gp |
git push |
gs |
git status |
gst |
git status |
gss |
git status -s |
gf |
git fetch |
gfo |
git fetch origin |
gdc |
git diff --cached |
gup |
git pull --rebase |
gsh |
git show |
grb |
git rebase |
grbi |
git rebase -i |
grba |
git rebase --abort |
grbc |
git rebase --continue |
gsta |
git stash |
gstp |
git stash pop |
gstaa |
git stash apply |
gsw |
git switch |
gswc |
git switch -c |
grt |
git restore |
grts |
git restore --staged |
gcp |
git cherry-pick |
gcpa |
git cherry-pick --abort |
gcpc |
git cherry-pick --continue |
- Clone this repository.
- Add or update aliases in both
cmd\aliases.cmd(doskey) andpowershell\GitAliases.ps1(function), and extend the table above if you add names. - Avoid breaking existing names without a good reason (downstream users type them from muscle memory).
- Open a pull request.