Skip to content

Instantly share code, notes, and snippets.

@mapsi
Last active January 31, 2026 08:59
Show Gist options
  • Select an option

  • Save mapsi/64cd77a0674a9d7a2036921465a2eff6 to your computer and use it in GitHub Desktop.

Select an option

Save mapsi/64cd77a0674a9d7a2036921465a2eff6 to your computer and use it in GitHub Desktop.

Revisions

  1. mapsi revised this gist Jan 31, 2026. No changes.
  2. mapsi revised this gist Jan 30, 2026. 1 changed file with 201 additions and 221 deletions.
    422 changes: 201 additions & 221 deletions git_abbreviations.fish
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@
    # Add this to ~/.config/fish/conf.d/abbreviations.fish or similar

    # Helper functions

    function git_main_branch --description 'Get the default main branch name'
    command git rev-parse --git-dir &>/dev/null; or return

    @@ -195,298 +196,277 @@ function ggp --description 'Push current branch to origin'
    end

    # Basic git commands
    abbr --add g git --description 'Git'
    abbr --add ga 'git add' --description 'Stage files'
    abbr --add gaa 'git add --all' --description 'Stage all changes'
    abbr --add gapa 'git add --patch' --description 'Stage changes interactively'
    abbr --add gau 'git add --update' --description 'Stage modified and deleted files'
    abbr --add gav 'git add --verbose' --description 'Stage files verbosely'
    abbr --add gwip 'git add -A; git rm (git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' --description 'Create a WIP commit'
    abbr -a g git
    abbr -a ga 'git add'
    abbr -a gaa 'git add --all'
    abbr -a gapa 'git add --patch'
    abbr -a gau 'git add --update'
    abbr -a gav 'git add --verbose'
    abbr -a gwip 'git add -A; git rm (git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'

    # Git am (apply mailbox)
    abbr --add gam 'git am' --description 'Apply patches from mailbox'
    abbr --add gama 'git am --abort' --description 'Abort am operation'
    abbr --add gamc 'git am --continue' --description 'Continue am operation'
    abbr --add gamscp 'git am --show-current-patch' --description 'Show current patch'
    abbr --add gams 'git am --skip' --description 'Skip current patch'
    abbr -a gam 'git am'
    abbr -a gama 'git am --abort'
    abbr -a gamc 'git am --continue'
    abbr -a gamscp 'git am --show-current-patch'
    abbr -a gams 'git am --skip'

    # Git apply
    abbr --add gap 'git apply' --description 'Apply a patch'
    abbr --add gapt 'git apply --3way' --description 'Apply patch with 3-way merge'
    abbr -a gap 'git apply'
    abbr -a gapt 'git apply --3way'

    # Git bisect
    abbr --add gbs 'git bisect' --description 'Bisect to find problematic commit'
    abbr --add gbsb 'git bisect bad' --description 'Mark commit as bad'
    abbr --add gbsg 'git bisect good' --description 'Mark commit as good'
    abbr --add gbsn 'git bisect new' --description 'Mark commit as new'
    abbr --add gbso 'git bisect old' --description 'Mark commit as old'
    abbr --add gbsr 'git bisect reset' --description 'Reset bisect'
    abbr --add gbss 'git bisect start' --description 'Start bisect'
    abbr -a gbs 'git bisect'
    abbr -a gbsb 'git bisect bad'
    abbr -a gbsg 'git bisect good'
    abbr -a gbsn 'git bisect new'
    abbr -a gbso 'git bisect old'
    abbr -a gbsr 'git bisect reset'
    abbr -a gbss 'git bisect start'

    # Git blame
    abbr --add gbl 'git blame -w' --description 'Show who changed each line (ignore whitespace)'
    abbr -a gbl 'git blame -w'

    # Git branch
    abbr --add gb 'git branch' --description 'List branches'
    abbr --add gba 'git branch --all' --description 'List all branches'
    abbr --add gbd 'git branch --delete' --description 'Delete branch'
    abbr --add gbD 'git branch --delete --force' --description 'Force delete branch'
    abbr --add gbm 'git branch --move' --description 'Rename branch'
    abbr --add gbnm 'git branch --no-merged' --description 'List unmerged branches'
    abbr --add gbr 'git branch --remote' --description 'List remote branches'
    abbr --add gbgd "LANG=C git branch --no-color -vv | grep \": gone]\" | cut -c 3- | awk '{print \$1}' | xargs git branch -d" --description 'Delete branches marked as gone'
    abbr --add gbgD "LANG=C git branch --no-color -vv | grep \": gone]\" | cut -c 3- | awk '{print \$1}' | xargs git branch -D" --description 'Force delete branches marked as gone'
    abbr --add gbg 'LANG=C git branch -vv | grep ": gone]"' --description 'Show branches marked as gone'
    abbr --add ggsup 'git branch --set-upstream-to=origin/(git_current_branch)' --description 'Set upstream for current branch'
    abbr -a gb 'git branch'
    abbr -a gba 'git branch --all'
    abbr -a gbd 'git branch --delete'
    abbr -a gbD 'git branch --delete --force'
    abbr -a gbm 'git branch --move'
    abbr -a gbnm 'git branch --no-merged'
    abbr -a gbr 'git branch --remote'
    abbr -a gbgd 'LANG=C git branch --no-color -vv | grep ": gone]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d'
    abbr -a gbgD 'LANG=C git branch --no-color -vv | grep ": gone]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D'
    abbr -a gbg 'LANG=C git branch -vv | grep ": gone]"'
    abbr -a ggsup 'git branch --set-upstream-to=origin/(git_current_branch)'

    # Git checkout
    abbr --add gco 'git checkout' --description 'Checkout branch or files'
    abbr --add gcor 'git checkout --recurse-submodules' --description 'Checkout with submodules'
    abbr --add gcb 'git checkout -b' --description 'Create and checkout branch'
    abbr --add gcB 'git checkout -B' --description 'Force create and checkout branch'
    abbr --add gcd 'git checkout (git_develop_branch)' --description 'Checkout develop branch'
    abbr --add gcm 'git checkout (git_main_branch)' --description 'Checkout main branch'
    abbr -a gco 'git checkout'
    abbr -a gcor 'git checkout --recurse-submodules'
    abbr -a gcb 'git checkout -b'
    abbr -a gcB 'git checkout -B'
    abbr -a gcd 'git checkout (git_develop_branch)'
    abbr -a gcm 'git checkout (git_main_branch)'

    # Git cherry-pick
    abbr --add gcp 'git cherry-pick' --description 'Apply commit to current branch'
    abbr --add gcpa 'git cherry-pick --abort' --description 'Abort cherry-pick'
    abbr --add gcpc 'git cherry-pick --continue' --description 'Continue cherry-pick'
    abbr -a gcp 'git cherry-pick'
    abbr -a gcpa 'git cherry-pick --abort'
    abbr -a gcpc 'git cherry-pick --continue'

    # Git clean
    abbr --add gclean 'git clean --interactive -d' --description 'Clean untracked files interactively'
    abbr -a gclean 'git clean --interactive -d'

    # Git clone
    abbr --add gcl 'git clone --recurse-submodules' --description 'Clone repo with submodules'
    abbr --add gclf 'git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules' --description 'Clone with partial blob filter'
    abbr -a gcl 'git clone --recurse-submodules'
    abbr -a gclf 'git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules'

    # Git commit
    abbr --add gcam 'git commit --all --message' --description 'Commit all changes with message'
    abbr --add gcas 'git commit --all --signoff' --description 'Commit all with signoff'
    abbr --add gcasm 'git commit --all --signoff --message' --description 'Commit all with signoff and message'
    abbr --add gcs 'git commit --gpg-sign' --description 'GPG sign commit'
    abbr --add gcss 'git commit --gpg-sign --signoff' --description 'GPG sign and signoff'
    abbr --add gcssm 'git commit --gpg-sign --signoff --message' --description 'GPG sign, signoff, and message'
    abbr --add gcmsg 'git commit --message' --description 'Commit with message'
    abbr --add gcsm 'git commit --signoff --message' --description 'Commit with signoff and message'
    abbr --add gc 'git commit --verbose' --description 'Commit verbosely'
    abbr --add gca 'git commit --verbose --all' --description 'Commit all changes verbosely'
    abbr --add 'gca!' 'git commit --verbose --all --amend' --description 'Amend all changes verbosely'
    abbr --add 'gcan!' 'git commit --verbose --all --no-edit --amend' --description 'Amend all without editing'
    abbr --add 'gcans!' 'git commit --verbose --all --signoff --no-edit --amend' --description 'Amend all with signoff, no edit'
    abbr --add 'gcann!' 'git commit --verbose --all --date=now --no-edit --amend' --description 'Amend with new date, no edit'
    abbr --add 'gc!' 'git commit --verbose --amend' --description 'Amend commit verbosely'
    abbr --add gcn 'git commit --verbose --no-edit' --description 'Commit without editing message'
    abbr --add 'gcn!' 'git commit --verbose --no-edit --amend' --description 'Amend without editing message'
    abbr --add gcf 'git config --list' --description 'List git config'
    abbr --add gcfu 'git commit --fixup' --description 'Commit as fixup'
    abbr -a gcam 'git commit --all --message'
    abbr -a gcas 'git commit --all --signoff'
    abbr -a gcasm 'git commit --all --signoff --message'
    abbr -a gcs 'git commit --gpg-sign'
    abbr -a gcss 'git commit --gpg-sign --signoff'
    abbr -a gcssm 'git commit --gpg-sign --signoff --message'
    abbr -a gcmsg 'git commit --message'
    abbr -a gcsm 'git commit --signoff --message'
    abbr -a gc 'git commit --verbose'
    abbr -a gca 'git commit --verbose --all'
    abbr -a 'gca!' 'git commit --verbose --all --amend'
    abbr -a 'gcan!' 'git commit --verbose --all --no-edit --amend'
    abbr -a 'gcans!' 'git commit --verbose --all --signoff --no-edit --amend'
    abbr -a 'gcann!' 'git commit --verbose --all --date=now --no-edit --amend'
    abbr -a 'gc!' 'git commit --verbose --amend'
    abbr -a gcn 'git commit --verbose --no-edit'
    abbr -a 'gcn!' 'git commit --verbose --no-edit --amend'
    abbr -a gcf 'git config --list'
    abbr -a gcfu 'git commit --fixup'

    # Git describe/diff
    abbr --add gdct 'git describe --tags (git rev-list --tags --max-count=1)' --description 'Show latest tag'
    abbr --add gd 'git diff' --description 'Show changes'
    abbr --add gdca 'git diff --cached' --description 'Show staged changes'
    abbr --add gdcw 'git diff --cached --word-diff' --description 'Show staged changes by word'
    abbr --add gds 'git diff --staged' --description 'Show staged changes'
    abbr --add gdw 'git diff --word-diff' --description 'Show changes by word'
    abbr --add gdup 'git diff @{upstream}' --description 'Show changes vs upstream'
    abbr --add gdt 'git diff-tree --no-commit-id --name-only -r' --description 'Show files changed in commit'
    abbr -a gdct 'git describe --tags (git rev-list --tags --max-count=1)'
    abbr -a gd 'git diff'
    abbr -a gdca 'git diff --cached'
    abbr -a gdcw 'git diff --cached --word-diff'
    abbr -a gds 'git diff --staged'
    abbr -a gdw 'git diff --word-diff'
    abbr -a gdup 'git diff @{upstream}'
    abbr -a gdt 'git diff-tree --no-commit-id --name-only -r'

    # Git fetch
    abbr --add gf 'git fetch' --description 'Fetch from remote'
    abbr --add gfa 'git fetch --all --tags --prune --jobs=10' --description 'Fetch all with tags and pruning'
    abbr --add gfo 'git fetch origin' --description 'Fetch from origin'
    abbr -a gf 'git fetch'
    abbr -a gfa 'git fetch --all --tags --prune --jobs=10'
    abbr -a gfo 'git fetch origin'

    # Git gui
    abbr --add gg 'git gui citool' --description 'Open git GUI'
    abbr --add gga 'git gui citool --amend' --description 'Open git GUI to amend'
    abbr -a gg 'git gui citool'
    abbr -a gga 'git gui citool --amend'

    # Git help
    abbr --add ghh 'git help' --description 'Show git help'
    abbr -a ghh 'git help'

    # Git log
    abbr --add glgg 'git log --graph' --description 'Log with graph'
    abbr --add glgga 'git log --graph --decorate --all' --description 'Log with graph, all branches'
    abbr --add glgm 'git log --graph --max-count=10' --description 'Log graph (last 10)'
    abbr --add glods 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short' --description 'Log with short date'
    abbr --add glod 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"' --description 'Log with full date'
    abbr --add glola 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all' --description 'Log with relative date, all'
    abbr --add glols 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat' --description 'Log with stats'
    abbr --add glol 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"' --description 'Log with relative date'
    abbr --add glo 'git log --oneline --decorate' --description 'Log oneline'
    abbr --add glog 'git log --oneline --decorate --graph' --description 'Log oneline with graph'
    abbr --add gloga 'git log --oneline --decorate --graph --all' --description 'Log oneline with graph, all'
    abbr --add glp '_git_log_prettily' --description 'Log with custom format'
    abbr --add glg 'git log --stat' --description 'Log with stats'
    abbr --add glgp 'git log --stat --patch' --description 'Log with stats and patches'
    abbr -a glgg 'git log --graph'
    abbr -a glgga 'git log --graph --decorate --all'
    abbr -a glgm 'git log --graph --max-count=10'
    abbr -a glods 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'
    abbr -a glod 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'
    abbr -a glola 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'
    abbr -a glols 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'
    abbr -a glol 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'
    abbr -a glo 'git log --oneline --decorate'
    abbr -a glog 'git log --oneline --decorate --graph'
    abbr -a gloga 'git log --oneline --decorate --graph --all'
    abbr -a glp '_git_log_prettily'
    abbr -a glg 'git log --stat'
    abbr -a glgp 'git log --stat --patch'

    # Git ls-files
    abbr --add gignored 'git ls-files -v | grep "^[[:lower:]]"' --description 'Show ignored files'
    abbr --add gfg 'git ls-files | grep' --description 'Grep tracked files'
    abbr -a gignored 'git ls-files -v | grep "^[[:lower:]]"'
    abbr -a gfg 'git ls-files | grep'

    # Git merge
    abbr --add gm 'git merge' --description 'Merge branch'
    abbr --add gma 'git merge --abort' --description 'Abort merge'
    abbr --add gmc 'git merge --continue' --description 'Continue merge'
    abbr --add gms 'git merge --squash' --description 'Merge with squash'
    abbr --add gmff 'git merge --ff-only' --description 'Merge fast-forward only'
    abbr --add gmom 'git merge origin/(git_main_branch)' --description 'Merge origin main'
    abbr --add gmum 'git merge upstream/(git_main_branch)' --description 'Merge upstream main'
    abbr --add gmtl 'git merge --no-prompt' --description 'Merge with default tool'
    abbr --add gmtlvim 'git mergetool --no-prompt --tool=vimdiff' --description 'Merge with vimdiff'
    abbr -a gm 'git merge'
    abbr -a gma 'git merge --abort'
    abbr -a gmc 'git merge --continue'
    abbr -a gms 'git merge --squash'
    abbr -a gmff 'git merge --ff-only'
    abbr -a gmom 'git merge origin/(git_main_branch)'
    abbr -a gmum 'git merge upstream/(git_main_branch)'
    abbr -a gmtl 'git merge --no-prompt'
    abbr -a gmtlvim 'git mergetool --no-prompt --tool=vimdiff'

    # Git pull
    abbr --add gl 'git pull' --description 'Pull from remote'
    abbr --add gpr 'git pull --rebase' --description 'Pull with rebase'
    abbr --add gprv 'git pull --rebase -v' --description 'Pull with rebase (verbose)'
    abbr --add gpra 'git pull --rebase --autostash' --description 'Pull with rebase and autostash'
    abbr --add gprav 'git pull --rebase --autostash -v' --description 'Pull with rebase, autostash, verbose'
    abbr --add gprom 'git pull --rebase origin (git_main_branch)' --description 'Pull main with rebase'
    abbr --add gpromi 'git pull --rebase=interactive origin (git_main_branch)' --description 'Pull main with interactive rebase'
    abbr --add gprum 'git pull --rebase upstream (git_main_branch)' --description 'Pull upstream main with rebase'
    abbr --add gprumi 'git pull --rebase=interactive upstream (git_main_branch)' --description 'Pull upstream main, interactive rebase'
    abbr --add ggpull 'git pull origin "(git_current_branch)"' --description 'Pull current branch'
    abbr --add gluc 'git pull upstream (git_current_branch)' --description 'Pull current from upstream'
    abbr --add glum 'git pull upstream (git_main_branch)' --description 'Pull main from upstream'
    abbr -a gl 'git pull'
    abbr -a gpr 'git pull --rebase'
    abbr -a gprv 'git pull --rebase -v'
    abbr -a gpra 'git pull --rebase --autostash'
    abbr -a gprav 'git pull --rebase --autostash -v'
    abbr -a gprom 'git pull --rebase origin (git_main_branch)'
    abbr -a gpromi 'git pull --rebase=interactive origin (git_main_branch)'
    abbr -a gprum 'git pull --rebase upstream (git_main_branch)'
    abbr -a gprumi 'git pull --rebase=interactive upstream (git_main_branch)'
    abbr -a ggpull 'git pull origin "(git_current_branch)"'
    abbr -a gluc 'git pull upstream (git_current_branch)'
    abbr -a glum 'git pull upstream (git_main_branch)'

    # Git push
    abbr --add gp 'git push' --description 'Push to remote'
    abbr --add gpd 'git push --dry-run' --description 'Dry run push'
    abbr --add 'gpf!' 'git push --force' --description 'Force push'
    abbr --add gpf 'git push --force-with-lease' --description 'Force push with lease'
    abbr --add gpv 'git push --verbose' --description 'Push verbosely'
    abbr --add gpoat 'git push origin --all && git push origin --tags' --description 'Push all branches and tags'
    abbr --add gpod 'git push origin --delete' --description 'Delete on origin'
    abbr --add gpu 'git push upstream' --description 'Push to upstream'
    abbr --add gpsup 'git push --set-upstream origin (git_current_branch)' --description 'Push and set upstream'
    abbr --add gpsupf 'git push --set-upstream origin (git_current_branch) --force-with-lease' --description 'Force push and set upstream'
    abbr --add ggpush 'git push origin "(git_current_branch)"' --description 'Push current branch'
    abbr -a gp 'git push'
    abbr -a gpd 'git push --dry-run'
    abbr -a 'gpf!' 'git push --force'
    abbr -a gpf 'git push --force-with-lease'
    abbr -a gpv 'git push --verbose'
    abbr -a gpoat 'git push origin --all && git push origin --tags'
    abbr -a gpod 'git push origin --delete'
    abbr -a gpu 'git push upstream'
    abbr -a gpsup 'git push --set-upstream origin (git_current_branch)'
    abbr -a gpsupf 'git push --set-upstream origin (git_current_branch) --force-with-lease'
    abbr -a ggpush 'git push origin "(git_current_branch)"'

    # Git rebase
    abbr --add grb 'git rebase' --description 'Rebase branch'
    abbr --add grba 'git rebase --abort' --description 'Abort rebase'
    abbr --add grbc 'git rebase --continue' --description 'Continue rebase'
    abbr --add grbi 'git rebase --interactive' --description 'Interactive rebase'
    abbr --add grbo 'git rebase --onto' --description 'Rebase onto branch'
    abbr --add grbs 'git rebase --skip' --description 'Skip commit in rebase'
    abbr --add grbd 'git rebase (git_develop_branch)' --description 'Rebase onto develop'
    abbr --add grbm 'git rebase (git_main_branch)' --description 'Rebase onto main'
    abbr --add grbom 'git rebase origin/(git_main_branch)' --description 'Rebase onto origin main'
    abbr --add grbum 'git rebase upstream/(git_main_branch)' --description 'Rebase onto upstream main'
    abbr -a grb 'git rebase'
    abbr -a grba 'git rebase --abort'
    abbr -a grbc 'git rebase --continue'
    abbr -a grbi 'git rebase --interactive'
    abbr -a grbo 'git rebase --onto'
    abbr -a grbs 'git rebase --skip'
    abbr -a grbd 'git rebase (git_develop_branch)'
    abbr -a grbm 'git rebase (git_main_branch)'
    abbr -a grbom 'git rebase origin/(git_main_branch)'
    abbr -a grbum 'git rebase upstream/(git_main_branch)'

    # Git reflog
    abbr --add grf 'git reflog' --description 'Show reflog'
    abbr -a grf 'git reflog'

    # Git remote
    abbr --add gr 'git remote' --description 'Manage remotes'
    abbr --add grv 'git remote --verbose' --description 'List remotes with URLs'
    abbr --add gra 'git remote add' --description 'Add remote'
    abbr --add grrm 'git remote remove' --description 'Remove remote'
    abbr --add grmv 'git remote rename' --description 'Rename remote'
    abbr --add grset 'git remote set-url' --description 'Set remote URL'
    abbr --add grup 'git remote update' --description 'Update remotes'
    abbr -a gr 'git remote'
    abbr -a grv 'git remote --verbose'
    abbr -a gra 'git remote add'
    abbr -a grrm 'git remote remove'
    abbr -a grmv 'git remote rename'
    abbr -a grset 'git remote set-url'
    abbr -a grup 'git remote update'

    # Git reset
    abbr --add grh 'git reset' --description 'Reset changes'
    abbr --add gru 'git reset --' --description 'Unstage files'
    abbr --add grhh 'git reset --hard' --description 'Hard reset'
    abbr --add grhk 'git reset --keep' --description 'Reset keeping changes'
    abbr --add grhs 'git reset --soft' --description 'Soft reset'
    abbr --add gpristine 'git reset --hard && git clean --force -dfx' --description 'Hard reset and clean'
    abbr --add gwipe 'git reset --hard && git clean --force -df' --description 'Hard reset and clean directories'
    abbr --add groh 'git reset origin/(git_current_branch) --hard' --description 'Reset to origin'
    abbr --add gunwip 'git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1' --description 'Undo WIP commit'
    abbr -a grh 'git reset'
    abbr -a gru 'git reset --'
    abbr -a grhh 'git reset --hard'
    abbr -a grhk 'git reset --keep'
    abbr -a grhs 'git reset --soft'
    abbr -a gpristine 'git reset --hard && git clean --force -dfx'
    abbr -a gwipe 'git reset --hard && git clean --force -df'
    abbr -a groh 'git reset origin/(git_current_branch) --hard'
    abbr -a gunwip 'git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'

    # Git restore
    abbr --add grs 'git restore' --description 'Restore files'
    abbr --add grss 'git restore --source' --description 'Restore from source'
    abbr --add grst 'git restore --staged' --description 'Unstage files'
    abbr -a grs 'git restore'
    abbr -a grss 'git restore --source'
    abbr -a grst 'git restore --staged'

    # Git revert
    abbr --add grev 'git revert' --description 'Revert commit'
    abbr --add greva 'git revert --abort' --description 'Abort revert'
    abbr --add grevc 'git revert --continue' --description 'Continue revert'
    abbr -a grev 'git revert'
    abbr -a greva 'git revert --abort'
    abbr -a grevc 'git revert --continue'

    # Git rm
    abbr --add grm 'git rm' --description 'Remove files'
    abbr --add grmc 'git rm --cached' --description 'Unstage files'
    abbr -a grm 'git rm'
    abbr -a grmc 'git rm --cached'

    # Git show
    abbr --add gsh 'git show' --description 'Show commit'
    abbr --add gsps 'git show --pretty=short --show-signature' --description 'Show with signature'
    abbr -a gsh 'git show'
    abbr -a gsps 'git show --pretty=short --show-signature'

    # Git shortlog
    abbr --add gcount 'git shortlog --summary --numbered' --description 'Count commits by author'
    abbr -a gcount 'git shortlog --summary --numbered'

    # Git stash
    abbr --add gstall 'git stash --all' --description 'Stash everything'
    abbr --add gstaa 'git stash apply' --description 'Apply stash'
    abbr --add gstc 'git stash clear' --description 'Clear stash'
    abbr --add gstd 'git stash drop' --description 'Delete stash'
    abbr --add gstl 'git stash list' --description 'List stash'
    abbr --add gstp 'git stash pop' --description 'Pop stash'
    abbr --add gsta 'git stash push' --description 'Stash changes'
    abbr --add gsts 'git stash show --patch' --description 'Show stash diff'
    abbr --add gstu 'gsta --include-untracked' --description 'Stash untracked files too'
    abbr -a gstall 'git stash --all'
    abbr -a gstaa 'git stash apply'
    abbr -a gstc 'git stash clear'
    abbr -a gstd 'git stash drop'
    abbr -a gstl 'git stash list'
    abbr -a gstp 'git stash pop'
    abbr -a gsta 'git stash push'
    abbr -a gsts 'git stash show --patch'
    abbr -a gstu 'gsta --include-untracked'

    # Git status
    abbr --add gst 'git status' --description 'Show status'
    abbr --add gss 'git status --short' --description 'Show short status'
    abbr --add gsb 'git status --short --branch' --description 'Show short status with branch'
    abbr -a gst 'git status'
    abbr -a gss 'git status --short'
    abbr -a gsb 'git status --short --branch'

    # Git submodule
    abbr --add gsi 'git submodule init' --description 'Initialize submodules'
    abbr --add gsu 'git submodule update' --description 'Update submodules'
    abbr -a gsi 'git submodule init'
    abbr -a gsu 'git submodule update'

    # Git svn
    abbr --add gsd 'git svn dcommit' --description 'SVN commit'
    abbr --add gsr 'git svn rebase' --description 'SVN rebase'
    abbr -a gsd 'git svn dcommit'
    abbr -a gsr 'git svn rebase'

    # Git switch
    abbr --add gsw 'git switch' --description 'Switch branch'
    abbr --add gswc 'git switch --create' --description 'Create and switch branch'
    abbr --add gswd 'git switch (git_develop_branch)' --description 'Switch to develop'
    abbr --add gswm 'git switch (git_main_branch)' --description 'Switch to main'
    abbr -a gsw 'git switch'
    abbr -a gswc 'git switch --create'
    abbr -a gswd 'git switch (git_develop_branch)'
    abbr -a gswm 'git switch (git_main_branch)'

    # Git tag
    abbr --add gta 'git tag --annotate' --description 'Create annotated tag'
    abbr --add gts 'git tag --sign' --description 'Create signed tag'
    abbr --add gtv 'git tag | sort -V' --description 'List tags sorted'
    abbr -a gta 'git tag --annotate'
    abbr -a gts 'git tag --sign'
    abbr -a gtv 'git tag | sort -V'

    # Git update-index
    abbr --add gignore 'git update-index --assume-unchanged' --description 'Assume file unchanged'
    abbr --add gunignore 'git update-index --no-assume-unchanged' --description 'Stop assuming file unchanged'
    abbr -a gignore 'git update-index --assume-unchanged'
    abbr -a gunignore 'git update-index --no-assume-unchanged'

    # Git worktree
    abbr --add gwt 'git worktree' --description 'Manage worktrees'
    abbr --add gwta 'git worktree add' --description 'Add worktree'
    abbr --add gwtls 'git worktree list' --description 'List worktrees'
    abbr --add gwtmv 'git worktree move' --description 'Move worktree'
    abbr --add gwtrm 'git worktree remove' --description 'Remove worktree'
    abbr -a gwt 'git worktree'
    abbr -a gwta 'git worktree add'
    abbr -a gwtls 'git worktree list'
    abbr -a gwtmv 'git worktree move'
    abbr -a gwtrm 'git worktree remove'

    # Miscellaneous
    abbr --add gwch 'git log --patch --abbrev-commit --pretty=medium --raw' --description 'Show what changed'
    abbr --add grt 'cd (git rev-parse --show-toplevel || echo .)' --description 'Go to repo root'
    abbr --add gk 'gitk --all --branches &!' --description 'Launch gitk'
    abbr --add gke 'gitk --all (git log --walk-reflogs --pretty=%h) &!' --description 'Launch gitk with reflogs'
    abbr --add gtl 'git tag --sort=-v:refname -n --list' --description 'List tags'
    abbr --add git-svn-dcommit-push 'git svn dcommit && git push github (git_main_branch):svntrunk' --description 'SVN commit and push'

    # Notes:
    # All helper functions from the oh-my-zsh git plugin have been converted!
    # Special abbreviations that use these functions:
    # - gcd, gcm: switch to develop/main branches
    # - gswd, gswm: switch to develop/main branches
    # - grbd, grbm, grbom, grbum: rebase onto develop/main branches
    # - gmom, gmum: merge origin/upstream main
    # - ggsup: set upstream for current branch
    # - gbg, gbgd, gbgD: find and delete branches marked as gone
    # - ggpull, ggpush: push/pull current branch
    # - gpsup, gpsupf: push with upstream tracking
    # - gbda: delete all merged branches (except main/develop)
    # - gbds: delete squashed branches
    # - gccd: clone and cd into repo
    # - gdv: git diff piped to view
    # - gdnolock: git diff excluding lock files
    # - gwip: WIP commit (use as function if you want git add -A behavior)
    # - gunwip, gunwipall: revert WIP commits
    # - grename: rename branch locally and on origin
    # - work_in_progress: check if current branch is WIP
    abbr -a gwch 'git log --patch --abbrev-commit --pretty=medium --raw'
    abbr -a grt 'cd (git rev-parse --show-toplevel || echo .)'
    abbr -a gk 'gitk --all --branches &!'
    abbr -a gke 'gitk --all (git log --walk-reflogs --pretty=%h) &!'
    abbr -a gtl 'git tag --sort=-v:refname -n --list'
    abbr -a git-svn-dcommit-push 'git svn dcommit && git push github (git_main_branch):svntrunk'
  3. mapsi revised this gist Jan 30, 2026. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion git_abbreviations.fish
    Original file line number Diff line number Diff line change
    @@ -85,8 +85,10 @@ function ggpnp --description 'Pull then push current branch'
    end

    function gbda --description 'Delete all merged branches'
    set -l main (git_main_branch)
    set -l develop (git_develop_branch)
    git branch --no-color --merged | \
    command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | \
    command grep -vE "^([+*]|\\s*($main|$develop)\\s*\$)" | \
    command xargs git branch --delete 2>/dev/null
    end

  4. mapsi created this gist Jan 30, 2026.
    490 changes: 490 additions & 0 deletions git_abbreviations.fish
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,490 @@
    # Git abbreviations converted from oh-my-zsh git plugin
    # Add this to ~/.config/fish/conf.d/abbreviations.fish or similar

    # Helper functions
    function git_main_branch --description 'Get the default main branch name'
    command git rev-parse --git-dir &>/dev/null; or return

    set -l branches main trunk mainline default stable master

    for branch in $branches
    for location in refs/heads refs/remotes/origin refs/remotes/upstream
    set -l ref $location/$branch
    if command git show-ref -q --verify $ref
    echo $branch
    return 0
    end
    end
    end

    # Fallback: try to get the default branch from remote HEAD symbolic refs
    for remote in origin upstream
    set -l ref (command git rev-parse --abbrev-ref $remote/HEAD 2>/dev/null)
    if string match -q "$remote/*" $ref
    echo (string replace "$remote/" "" $ref)
    return 0
    end
    end

    # If no main branch was found, fall back to master but return error
    echo master
    return 1
    end

    function git_develop_branch --description 'Get the default develop branch name'
    command git rev-parse --git-dir &>/dev/null; or return
    for branch in dev devel develop development
    if command git show-ref -q --verify refs/heads/$branch
    echo $branch
    return 0
    end
    end
    echo develop
    return 1
    end

    function git_current_branch --description 'Get the current branch name'
    set -l ref (command git symbolic-ref --quiet --short HEAD 2>/dev/null)
    and echo $ref
    or echo (command git rev-parse --short HEAD 2>/dev/null)
    end

    function grename --description 'Rename a branch locally and on origin'
    if test -z "$argv[1]" -o -z "$argv[2]"
    echo "Usage: $0 old_branch new_branch"
    return 1
    end

    # Rename branch locally
    git branch -m "$argv[1]" "$argv[2]"
    # Rename branch in origin remote
    if git push origin :"$argv[1]"
    git push --set-upstream origin "$argv[2]"
    end
    end

    function gunwipall --description 'Remove all WIP commits'
    set -l _commit (git log --grep='--wip--' --invert-grep --max-count=1 --format=format:%H)

    # Check if a commit without "--wip--" was found and it's not the same as HEAD
    if test "$_commit" != (git rev-parse HEAD)
    git reset $_commit; or return 1
    end
    end

    function work_in_progress --description 'Check if current branch is WIP'
    command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
    end

    function ggpnp --description 'Pull then push current branch'
    if test (count $argv) -eq 0
    ggl && ggp
    else
    ggl $argv && ggp $argv
    end
    end

    function gbda --description 'Delete all merged branches'
    git branch --no-color --merged | \
    command grep -vE "^([+*]|\s*($(git_main_branch)|$(git_develop_branch))\s*$)" | \
    command xargs git branch --delete 2>/dev/null
    end

    function gbds --description 'Delete all squashed branches'
    set -l default_branch (git_main_branch)
    test $status -ne 0; and set default_branch (git_develop_branch)

    git for-each-ref refs/heads/ "--format=%(refname:short)" | \
    while read branch
    set -l merge_base (git merge-base $default_branch $branch)
    if test (git cherry $default_branch (git commit-tree (git rev-parse $branch^{tree}) -p $merge_base -m _) | string match '*' -) = '-'
    git branch -D $branch
    end
    end
    end

    function gdv --description 'Show git diff in view'
    git diff -w $argv | view -
    end

    function gdnolock --description 'Show git diff excluding lock files'
    git diff $argv ":(exclude)package-lock.json" ":(exclude)*.lock"
    end

    function gccd --description 'Clone repo and cd into it'
    # Get repo URI from args - simplified version for fish
    set -l repo $argv[-1]

    # Clone repository and exit if it fails
    command git clone --recurse-submodules $argv; or return

    # If last arg was a directory, that's where the repo was cloned
    # Otherwise parse the repo URI and use the last part as the directory
    if test -d $repo
    cd $repo
    else
    set -l dirname (string replace -r '\.git/?$' '' (basename $repo))
    cd $dirname
    end
    end

    function _git_log_prettily --description 'Show git log with custom format'
    if test -n "$argv[1]"
    git log --pretty=$argv[1]
    end
    end

    function ggu --description 'Pull current branch with rebase from origin'
    set -l b (git_current_branch)
    if test (count $argv) -ne 1
    set b (git_current_branch)
    else
    set b $argv[1]
    end
    git pull --rebase origin $b
    end

    function ggl --description 'Pull current branch from origin'
    if test (count $argv) -gt 1
    git pull origin $argv
    else
    set -l b (git_current_branch)
    if test (count $argv) -eq 0
    set b (git_current_branch)
    else
    set b $argv[1]
    end
    git pull origin $b
    end
    end

    function ggf --description 'Force push current branch to origin'
    set -l b (git_current_branch)
    if test (count $argv) -ne 1
    set b (git_current_branch)
    else
    set b $argv[1]
    end
    git push --force origin $b
    end

    function ggfl --description 'Force push with lease current branch to origin'
    set -l b (git_current_branch)
    if test (count $argv) -ne 1
    set b (git_current_branch)
    else
    set b $argv[1]
    end
    git push --force-with-lease origin $b
    end

    function ggp --description 'Push current branch to origin'
    if test (count $argv) -gt 1
    git push origin $argv
    else
    set -l b (git_current_branch)
    if test (count $argv) -eq 0
    set b (git_current_branch)
    else
    set b $argv[1]
    end
    git push origin $b
    end
    end

    # Basic git commands
    abbr --add g git --description 'Git'
    abbr --add ga 'git add' --description 'Stage files'
    abbr --add gaa 'git add --all' --description 'Stage all changes'
    abbr --add gapa 'git add --patch' --description 'Stage changes interactively'
    abbr --add gau 'git add --update' --description 'Stage modified and deleted files'
    abbr --add gav 'git add --verbose' --description 'Stage files verbosely'
    abbr --add gwip 'git add -A; git rm (git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"' --description 'Create a WIP commit'

    # Git am (apply mailbox)
    abbr --add gam 'git am' --description 'Apply patches from mailbox'
    abbr --add gama 'git am --abort' --description 'Abort am operation'
    abbr --add gamc 'git am --continue' --description 'Continue am operation'
    abbr --add gamscp 'git am --show-current-patch' --description 'Show current patch'
    abbr --add gams 'git am --skip' --description 'Skip current patch'

    # Git apply
    abbr --add gap 'git apply' --description 'Apply a patch'
    abbr --add gapt 'git apply --3way' --description 'Apply patch with 3-way merge'

    # Git bisect
    abbr --add gbs 'git bisect' --description 'Bisect to find problematic commit'
    abbr --add gbsb 'git bisect bad' --description 'Mark commit as bad'
    abbr --add gbsg 'git bisect good' --description 'Mark commit as good'
    abbr --add gbsn 'git bisect new' --description 'Mark commit as new'
    abbr --add gbso 'git bisect old' --description 'Mark commit as old'
    abbr --add gbsr 'git bisect reset' --description 'Reset bisect'
    abbr --add gbss 'git bisect start' --description 'Start bisect'

    # Git blame
    abbr --add gbl 'git blame -w' --description 'Show who changed each line (ignore whitespace)'

    # Git branch
    abbr --add gb 'git branch' --description 'List branches'
    abbr --add gba 'git branch --all' --description 'List all branches'
    abbr --add gbd 'git branch --delete' --description 'Delete branch'
    abbr --add gbD 'git branch --delete --force' --description 'Force delete branch'
    abbr --add gbm 'git branch --move' --description 'Rename branch'
    abbr --add gbnm 'git branch --no-merged' --description 'List unmerged branches'
    abbr --add gbr 'git branch --remote' --description 'List remote branches'
    abbr --add gbgd "LANG=C git branch --no-color -vv | grep \": gone]\" | cut -c 3- | awk '{print \$1}' | xargs git branch -d" --description 'Delete branches marked as gone'
    abbr --add gbgD "LANG=C git branch --no-color -vv | grep \": gone]\" | cut -c 3- | awk '{print \$1}' | xargs git branch -D" --description 'Force delete branches marked as gone'
    abbr --add gbg 'LANG=C git branch -vv | grep ": gone]"' --description 'Show branches marked as gone'
    abbr --add ggsup 'git branch --set-upstream-to=origin/(git_current_branch)' --description 'Set upstream for current branch'

    # Git checkout
    abbr --add gco 'git checkout' --description 'Checkout branch or files'
    abbr --add gcor 'git checkout --recurse-submodules' --description 'Checkout with submodules'
    abbr --add gcb 'git checkout -b' --description 'Create and checkout branch'
    abbr --add gcB 'git checkout -B' --description 'Force create and checkout branch'
    abbr --add gcd 'git checkout (git_develop_branch)' --description 'Checkout develop branch'
    abbr --add gcm 'git checkout (git_main_branch)' --description 'Checkout main branch'

    # Git cherry-pick
    abbr --add gcp 'git cherry-pick' --description 'Apply commit to current branch'
    abbr --add gcpa 'git cherry-pick --abort' --description 'Abort cherry-pick'
    abbr --add gcpc 'git cherry-pick --continue' --description 'Continue cherry-pick'

    # Git clean
    abbr --add gclean 'git clean --interactive -d' --description 'Clean untracked files interactively'

    # Git clone
    abbr --add gcl 'git clone --recurse-submodules' --description 'Clone repo with submodules'
    abbr --add gclf 'git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules' --description 'Clone with partial blob filter'

    # Git commit
    abbr --add gcam 'git commit --all --message' --description 'Commit all changes with message'
    abbr --add gcas 'git commit --all --signoff' --description 'Commit all with signoff'
    abbr --add gcasm 'git commit --all --signoff --message' --description 'Commit all with signoff and message'
    abbr --add gcs 'git commit --gpg-sign' --description 'GPG sign commit'
    abbr --add gcss 'git commit --gpg-sign --signoff' --description 'GPG sign and signoff'
    abbr --add gcssm 'git commit --gpg-sign --signoff --message' --description 'GPG sign, signoff, and message'
    abbr --add gcmsg 'git commit --message' --description 'Commit with message'
    abbr --add gcsm 'git commit --signoff --message' --description 'Commit with signoff and message'
    abbr --add gc 'git commit --verbose' --description 'Commit verbosely'
    abbr --add gca 'git commit --verbose --all' --description 'Commit all changes verbosely'
    abbr --add 'gca!' 'git commit --verbose --all --amend' --description 'Amend all changes verbosely'
    abbr --add 'gcan!' 'git commit --verbose --all --no-edit --amend' --description 'Amend all without editing'
    abbr --add 'gcans!' 'git commit --verbose --all --signoff --no-edit --amend' --description 'Amend all with signoff, no edit'
    abbr --add 'gcann!' 'git commit --verbose --all --date=now --no-edit --amend' --description 'Amend with new date, no edit'
    abbr --add 'gc!' 'git commit --verbose --amend' --description 'Amend commit verbosely'
    abbr --add gcn 'git commit --verbose --no-edit' --description 'Commit without editing message'
    abbr --add 'gcn!' 'git commit --verbose --no-edit --amend' --description 'Amend without editing message'
    abbr --add gcf 'git config --list' --description 'List git config'
    abbr --add gcfu 'git commit --fixup' --description 'Commit as fixup'

    # Git describe/diff
    abbr --add gdct 'git describe --tags (git rev-list --tags --max-count=1)' --description 'Show latest tag'
    abbr --add gd 'git diff' --description 'Show changes'
    abbr --add gdca 'git diff --cached' --description 'Show staged changes'
    abbr --add gdcw 'git diff --cached --word-diff' --description 'Show staged changes by word'
    abbr --add gds 'git diff --staged' --description 'Show staged changes'
    abbr --add gdw 'git diff --word-diff' --description 'Show changes by word'
    abbr --add gdup 'git diff @{upstream}' --description 'Show changes vs upstream'
    abbr --add gdt 'git diff-tree --no-commit-id --name-only -r' --description 'Show files changed in commit'

    # Git fetch
    abbr --add gf 'git fetch' --description 'Fetch from remote'
    abbr --add gfa 'git fetch --all --tags --prune --jobs=10' --description 'Fetch all with tags and pruning'
    abbr --add gfo 'git fetch origin' --description 'Fetch from origin'

    # Git gui
    abbr --add gg 'git gui citool' --description 'Open git GUI'
    abbr --add gga 'git gui citool --amend' --description 'Open git GUI to amend'

    # Git help
    abbr --add ghh 'git help' --description 'Show git help'

    # Git log
    abbr --add glgg 'git log --graph' --description 'Log with graph'
    abbr --add glgga 'git log --graph --decorate --all' --description 'Log with graph, all branches'
    abbr --add glgm 'git log --graph --max-count=10' --description 'Log graph (last 10)'
    abbr --add glods 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short' --description 'Log with short date'
    abbr --add glod 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"' --description 'Log with full date'
    abbr --add glola 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all' --description 'Log with relative date, all'
    abbr --add glols 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat' --description 'Log with stats'
    abbr --add glol 'git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"' --description 'Log with relative date'
    abbr --add glo 'git log --oneline --decorate' --description 'Log oneline'
    abbr --add glog 'git log --oneline --decorate --graph' --description 'Log oneline with graph'
    abbr --add gloga 'git log --oneline --decorate --graph --all' --description 'Log oneline with graph, all'
    abbr --add glp '_git_log_prettily' --description 'Log with custom format'
    abbr --add glg 'git log --stat' --description 'Log with stats'
    abbr --add glgp 'git log --stat --patch' --description 'Log with stats and patches'

    # Git ls-files
    abbr --add gignored 'git ls-files -v | grep "^[[:lower:]]"' --description 'Show ignored files'
    abbr --add gfg 'git ls-files | grep' --description 'Grep tracked files'

    # Git merge
    abbr --add gm 'git merge' --description 'Merge branch'
    abbr --add gma 'git merge --abort' --description 'Abort merge'
    abbr --add gmc 'git merge --continue' --description 'Continue merge'
    abbr --add gms 'git merge --squash' --description 'Merge with squash'
    abbr --add gmff 'git merge --ff-only' --description 'Merge fast-forward only'
    abbr --add gmom 'git merge origin/(git_main_branch)' --description 'Merge origin main'
    abbr --add gmum 'git merge upstream/(git_main_branch)' --description 'Merge upstream main'
    abbr --add gmtl 'git merge --no-prompt' --description 'Merge with default tool'
    abbr --add gmtlvim 'git mergetool --no-prompt --tool=vimdiff' --description 'Merge with vimdiff'

    # Git pull
    abbr --add gl 'git pull' --description 'Pull from remote'
    abbr --add gpr 'git pull --rebase' --description 'Pull with rebase'
    abbr --add gprv 'git pull --rebase -v' --description 'Pull with rebase (verbose)'
    abbr --add gpra 'git pull --rebase --autostash' --description 'Pull with rebase and autostash'
    abbr --add gprav 'git pull --rebase --autostash -v' --description 'Pull with rebase, autostash, verbose'
    abbr --add gprom 'git pull --rebase origin (git_main_branch)' --description 'Pull main with rebase'
    abbr --add gpromi 'git pull --rebase=interactive origin (git_main_branch)' --description 'Pull main with interactive rebase'
    abbr --add gprum 'git pull --rebase upstream (git_main_branch)' --description 'Pull upstream main with rebase'
    abbr --add gprumi 'git pull --rebase=interactive upstream (git_main_branch)' --description 'Pull upstream main, interactive rebase'
    abbr --add ggpull 'git pull origin "(git_current_branch)"' --description 'Pull current branch'
    abbr --add gluc 'git pull upstream (git_current_branch)' --description 'Pull current from upstream'
    abbr --add glum 'git pull upstream (git_main_branch)' --description 'Pull main from upstream'

    # Git push
    abbr --add gp 'git push' --description 'Push to remote'
    abbr --add gpd 'git push --dry-run' --description 'Dry run push'
    abbr --add 'gpf!' 'git push --force' --description 'Force push'
    abbr --add gpf 'git push --force-with-lease' --description 'Force push with lease'
    abbr --add gpv 'git push --verbose' --description 'Push verbosely'
    abbr --add gpoat 'git push origin --all && git push origin --tags' --description 'Push all branches and tags'
    abbr --add gpod 'git push origin --delete' --description 'Delete on origin'
    abbr --add gpu 'git push upstream' --description 'Push to upstream'
    abbr --add gpsup 'git push --set-upstream origin (git_current_branch)' --description 'Push and set upstream'
    abbr --add gpsupf 'git push --set-upstream origin (git_current_branch) --force-with-lease' --description 'Force push and set upstream'
    abbr --add ggpush 'git push origin "(git_current_branch)"' --description 'Push current branch'

    # Git rebase
    abbr --add grb 'git rebase' --description 'Rebase branch'
    abbr --add grba 'git rebase --abort' --description 'Abort rebase'
    abbr --add grbc 'git rebase --continue' --description 'Continue rebase'
    abbr --add grbi 'git rebase --interactive' --description 'Interactive rebase'
    abbr --add grbo 'git rebase --onto' --description 'Rebase onto branch'
    abbr --add grbs 'git rebase --skip' --description 'Skip commit in rebase'
    abbr --add grbd 'git rebase (git_develop_branch)' --description 'Rebase onto develop'
    abbr --add grbm 'git rebase (git_main_branch)' --description 'Rebase onto main'
    abbr --add grbom 'git rebase origin/(git_main_branch)' --description 'Rebase onto origin main'
    abbr --add grbum 'git rebase upstream/(git_main_branch)' --description 'Rebase onto upstream main'

    # Git reflog
    abbr --add grf 'git reflog' --description 'Show reflog'

    # Git remote
    abbr --add gr 'git remote' --description 'Manage remotes'
    abbr --add grv 'git remote --verbose' --description 'List remotes with URLs'
    abbr --add gra 'git remote add' --description 'Add remote'
    abbr --add grrm 'git remote remove' --description 'Remove remote'
    abbr --add grmv 'git remote rename' --description 'Rename remote'
    abbr --add grset 'git remote set-url' --description 'Set remote URL'
    abbr --add grup 'git remote update' --description 'Update remotes'

    # Git reset
    abbr --add grh 'git reset' --description 'Reset changes'
    abbr --add gru 'git reset --' --description 'Unstage files'
    abbr --add grhh 'git reset --hard' --description 'Hard reset'
    abbr --add grhk 'git reset --keep' --description 'Reset keeping changes'
    abbr --add grhs 'git reset --soft' --description 'Soft reset'
    abbr --add gpristine 'git reset --hard && git clean --force -dfx' --description 'Hard reset and clean'
    abbr --add gwipe 'git reset --hard && git clean --force -df' --description 'Hard reset and clean directories'
    abbr --add groh 'git reset origin/(git_current_branch) --hard' --description 'Reset to origin'
    abbr --add gunwip 'git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1' --description 'Undo WIP commit'

    # Git restore
    abbr --add grs 'git restore' --description 'Restore files'
    abbr --add grss 'git restore --source' --description 'Restore from source'
    abbr --add grst 'git restore --staged' --description 'Unstage files'

    # Git revert
    abbr --add grev 'git revert' --description 'Revert commit'
    abbr --add greva 'git revert --abort' --description 'Abort revert'
    abbr --add grevc 'git revert --continue' --description 'Continue revert'

    # Git rm
    abbr --add grm 'git rm' --description 'Remove files'
    abbr --add grmc 'git rm --cached' --description 'Unstage files'

    # Git show
    abbr --add gsh 'git show' --description 'Show commit'
    abbr --add gsps 'git show --pretty=short --show-signature' --description 'Show with signature'

    # Git shortlog
    abbr --add gcount 'git shortlog --summary --numbered' --description 'Count commits by author'

    # Git stash
    abbr --add gstall 'git stash --all' --description 'Stash everything'
    abbr --add gstaa 'git stash apply' --description 'Apply stash'
    abbr --add gstc 'git stash clear' --description 'Clear stash'
    abbr --add gstd 'git stash drop' --description 'Delete stash'
    abbr --add gstl 'git stash list' --description 'List stash'
    abbr --add gstp 'git stash pop' --description 'Pop stash'
    abbr --add gsta 'git stash push' --description 'Stash changes'
    abbr --add gsts 'git stash show --patch' --description 'Show stash diff'
    abbr --add gstu 'gsta --include-untracked' --description 'Stash untracked files too'

    # Git status
    abbr --add gst 'git status' --description 'Show status'
    abbr --add gss 'git status --short' --description 'Show short status'
    abbr --add gsb 'git status --short --branch' --description 'Show short status with branch'

    # Git submodule
    abbr --add gsi 'git submodule init' --description 'Initialize submodules'
    abbr --add gsu 'git submodule update' --description 'Update submodules'

    # Git svn
    abbr --add gsd 'git svn dcommit' --description 'SVN commit'
    abbr --add gsr 'git svn rebase' --description 'SVN rebase'

    # Git switch
    abbr --add gsw 'git switch' --description 'Switch branch'
    abbr --add gswc 'git switch --create' --description 'Create and switch branch'
    abbr --add gswd 'git switch (git_develop_branch)' --description 'Switch to develop'
    abbr --add gswm 'git switch (git_main_branch)' --description 'Switch to main'

    # Git tag
    abbr --add gta 'git tag --annotate' --description 'Create annotated tag'
    abbr --add gts 'git tag --sign' --description 'Create signed tag'
    abbr --add gtv 'git tag | sort -V' --description 'List tags sorted'

    # Git update-index
    abbr --add gignore 'git update-index --assume-unchanged' --description 'Assume file unchanged'
    abbr --add gunignore 'git update-index --no-assume-unchanged' --description 'Stop assuming file unchanged'

    # Git worktree
    abbr --add gwt 'git worktree' --description 'Manage worktrees'
    abbr --add gwta 'git worktree add' --description 'Add worktree'
    abbr --add gwtls 'git worktree list' --description 'List worktrees'
    abbr --add gwtmv 'git worktree move' --description 'Move worktree'
    abbr --add gwtrm 'git worktree remove' --description 'Remove worktree'

    # Miscellaneous
    abbr --add gwch 'git log --patch --abbrev-commit --pretty=medium --raw' --description 'Show what changed'
    abbr --add grt 'cd (git rev-parse --show-toplevel || echo .)' --description 'Go to repo root'
    abbr --add gk 'gitk --all --branches &!' --description 'Launch gitk'
    abbr --add gke 'gitk --all (git log --walk-reflogs --pretty=%h) &!' --description 'Launch gitk with reflogs'
    abbr --add gtl 'git tag --sort=-v:refname -n --list' --description 'List tags'
    abbr --add git-svn-dcommit-push 'git svn dcommit && git push github (git_main_branch):svntrunk' --description 'SVN commit and push'

    # Notes:
    # All helper functions from the oh-my-zsh git plugin have been converted!
    # Special abbreviations that use these functions:
    # - gcd, gcm: switch to develop/main branches
    # - gswd, gswm: switch to develop/main branches
    # - grbd, grbm, grbom, grbum: rebase onto develop/main branches
    # - gmom, gmum: merge origin/upstream main
    # - ggsup: set upstream for current branch
    # - gbg, gbgd, gbgD: find and delete branches marked as gone
    # - ggpull, ggpush: push/pull current branch
    # - gpsup, gpsupf: push with upstream tracking
    # - gbda: delete all merged branches (except main/develop)
    # - gbds: delete squashed branches
    # - gccd: clone and cd into repo
    # - gdv: git diff piped to view
    # - gdnolock: git diff excluding lock files
    # - gwip: WIP commit (use as function if you want git add -A behavior)
    # - gunwip, gunwipall: revert WIP commits
    # - grename: rename branch locally and on origin
    # - work_in_progress: check if current branch is WIP