From 7e8cd9fe83786b806b4d78e38413f90375597a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez?= Date: Wed, 21 Oct 2026 15:17:42 +0100 Subject: [PATCH] Add git abbreviations missing from the oh-my-zsh and plugin-git sets `aliases/git` and `abbreviations/git` are ports of the oh-my-zsh git plugin, but a few names never made it across; the fish `plugin-git` (a port of the same alias set with extras) has more that are useful. From oh-my-zsh, which the port dropped: g ggsup glom grbmi grbmia grbom gsuri gwtrm From fish `plugin-git`: gcav gcav! gcfx gcv gscam gdg gdsc gdto gdwc gfm ggl ggp ggp! ggpnp ggu gclean! grbdia grbdi grbomi grbomia grhpa grpo gsur gwtlo gwtpr gwtulo Both files get the same set, since they are meant to stay in sync; `gwta` is added to the abbreviation file only, where the alias already existed. Names that only restate an existing one with a different flag (`gp!`, `gmt`, `gpo`, `glr`, `gloo`, `gcod`, `gcom`, `gban`) are left out to avoid duplicate spellings, as are the `git flow` and GitLab merge request aliases. Three implementation notes: - `grbom`/`grbomi`/`grbomia` and `gfm` fetch the default branch and then rebase/merge `FETCH_HEAD`, rather than using a possibly stale `origin/
`. - `glom` uses string interpolation because `(git_main_branch)..` is parsed by nushell as an integer range, not as a git revision range. - `gfm`, `ggpnp` and the `grbom*` names are `def`s, as they run two commands. --- abbreviations/git/git-abbreviations.nu | 35 ++++++++++++++++++ aliases/git/git-aliases.nu | 49 ++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/abbreviations/git/git-abbreviations.nu b/abbreviations/git/git-abbreviations.nu index 7fe48d3f..bc813c47 100644 --- a/abbreviations/git/git-abbreviations.nu +++ b/abbreviations/git/git-abbreviations.nu @@ -19,6 +19,7 @@ export def git_main_branch [] { # const git_abbreviations = { + g: "git" ga: "git add" gaa: "git add --all" gapa: "git add --patch" @@ -53,11 +54,16 @@ const git_abbreviations = { gcam: "git commit --all --message" gcas: "git commit --all --signoff" gcasm: "git commit --all --signoff --message" + gcav: "git commit --all --verbose --no-verify" + gcav!: "git commit --all --verbose --no-verify --amend" + gcfx: "git commit --fixup" + gcv: "git commit --verbose --no-verify" gcb: "git checkout -b" gcd: "git checkout develop" gcf: "git config --list" gcl: "git clone --recurse-submodules" gclean: "git clean --interactive -d" + gclean!: "git clean -d --force -x" gpristine: "git reset --hard; git clean -d --force -x" gcm: "git checkout (git_main_branch)" gcmsg: "git commit --message" @@ -70,6 +76,7 @@ const git_abbreviations = { gcs: "git commit --gpg-sign" gcss: "git commit --gpg-sign --signoff" gcssm: "git commit --gpg-sign --signoff --message" + gscam: "git commit --gpg-sign --all --message" gd: "git diff" gdca: "git diff --cached" gdcw: "git diff --cached --word-diff" @@ -78,11 +85,22 @@ const git_abbreviations = { gdt: "git diff-tree --no-commit-id --name-only -r" gdup: "git diff @{upstream}" gdw: "git diff --word-diff" + gdg: "git diff --no-ext-diff" + gdsc: "git diff --stat --cached" + gdto: "git difftool" + gdwc: "git diff --word-diff --cached" gf: "git fetch" gfa: "git fetch --all --prune" gfo: "git fetch origin" + gfm: "git fetch origin (git_main_branch); git merge FETCH_HEAD" gg: "git gui citool" gga: "git gui citool --amend" + ggsup: "git branch --set-upstream-to $\"origin/(git_current_branch)\"" + ggl: "git pull origin (git_current_branch)" + ggp: "git push origin (git_current_branch)" + ggp!: "git push origin (git_current_branch) --force-with-lease" + ggpnp: "git pull origin (git_current_branch); git push origin (git_current_branch)" + ggu: "git pull --rebase origin (git_current_branch)" ghh: "git help" gignore: "git update-index --assume-unchanged" gl: "git log" @@ -99,6 +117,7 @@ const git_abbreviations = { glol: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset'" glola: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --all" glols: "git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --stat" + glom: "git log --oneline --decorate $\"(git_main_branch)..\"" gm: "git merge" gmtl: "git mergetool --no-prompt" gmtlvim: "git mergetool --no-prompt --tool=vimdiff" @@ -125,16 +144,25 @@ const git_abbreviations = { grba: "git rebase --abort" grbc: "git rebase --continue" grbd: "git rebase develop" + grbdi: "git rebase develop --interactive" + grbdia: "git rebase develop --interactive --autosquash" grbi: "git rebase --interactive" grbm: "git rebase (git_main_branch)" + grbmi: "git rebase (git_main_branch) --interactive" + grbmia: "git rebase (git_main_branch) --interactive --autosquash" grbo: "git rebase --onto" + grbom: "git fetch origin (git_main_branch); git rebase FETCH_HEAD" + grbomi: "git fetch origin (git_main_branch); git rebase FETCH_HEAD --interactive" + grbomia: "git fetch origin (git_main_branch); git rebase FETCH_HEAD --interactive --autosquash" grbs: "git rebase --skip" grev: "git revert" grh: "git reset" grhh: "git reset --hard" + grhpa: "git reset --patch" groh: "git reset $\"origin/(git_current_branch)\" --hard" grm: "git rm" grmc: "git rm --cached" + grpo: "git remote prune origin" grmv: "git remote rename" grrm: "git remote remove" grs: "git restore" @@ -164,6 +192,8 @@ const git_abbreviations = { gstu: "gsta --include-untracked" gstall: "git stash --all" gsu: "git submodule update" + gsuri: "git submodule update --recursive --init" + gsur: "git submodule update --recursive" gsw: "git switch" gswc: "git switch --create" gts: "git tag --sign" @@ -176,9 +206,14 @@ const git_abbreviations = { gupav: "git pull --rebase --autostash --verbose" gwch: "git whatchanged -p --abbrev-commit --pretty=medium" gwt: "git worktree" + gwta: "git worktree add" gwtls: "git worktree list" gwtmv: "git worktree move" gwtm: "git worktree remove" + gwtrm: "git worktree remove" + gwtlo: "git worktree lock" + gwtpr: "git worktree prune" + gwtulo: "git worktree unlock" gam: "git am" gamc: "git am --continue" gams: "git am --skip" diff --git a/aliases/git/git-aliases.nu b/aliases/git/git-aliases.nu index f69b3f13..cc75b141 100644 --- a/aliases/git/git-aliases.nu +++ b/aliases/git/git-aliases.nu @@ -18,6 +18,7 @@ export def git_main_branch [] { # (sorted alphabetically) # +export alias g = git export alias ga = git add export alias gaa = git add --all export alias gapa = git add --patch @@ -61,11 +62,16 @@ export alias gcas = git commit --all --signoff export def gcasm [message: string] { git commit --all --signoff --message $message } +export alias gcav = git commit --all --verbose --no-verify +export alias gcav! = git commit --all --verbose --no-verify --amend +export alias gcfx = git commit --fixup +export alias gcv = git commit --verbose --no-verify export alias gcb = git checkout -b export alias gcd = git checkout develop export alias gcf = git config --list export alias gcl = git clone --recurse-submodules export alias gclean = git clean --interactive -d +export alias gclean! = git clean -d --force -x export def gpristine [] { git reset --hard git clean -d --force -x @@ -85,6 +91,7 @@ export alias gcss = git commit --gpg-sign --signoff export def gcssm [message: string] { git commit --gpg-sign --signoff --message $message } +export alias gscam = git commit --gpg-sign --all --message export alias gd = git diff export alias gdca = git diff --cached export alias gdcw = git diff --cached --word-diff @@ -93,13 +100,30 @@ export alias gds = git diff --staged export alias gdt = git diff-tree --no-commit-id --name-only -r export alias gdup = git diff @{upstream} export alias gdw = git diff --word-diff +export alias gdg = git diff --no-ext-diff +export alias gdsc = git diff --stat --cached +export alias gdto = git difftool +export alias gdwc = git diff --word-diff --cached export alias gf = git fetch export alias gfa = git fetch --all --prune export alias gfo = git fetch origin +export def gfm [] { + git fetch origin (git_main_branch) + git merge FETCH_HEAD +} export alias gg = git gui citool export alias gga = git gui citool --amend +export alias ggsup = git branch --set-upstream-to $"origin/(git_current_branch)" +export alias ggl = git pull origin (git_current_branch) +export alias ggp = git push origin (git_current_branch) +export alias ggp! = git push origin (git_current_branch) --force-with-lease +export def ggpnp [] { + git pull origin (git_current_branch) + git push origin (git_current_branch) +} +export alias ggu = git pull --rebase origin (git_current_branch) export alias ghh = git help @@ -119,6 +143,7 @@ export alias gloga = git log --oneline --decorate --graph --all export alias glol = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' export alias glola = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --all export alias glols = git log --graph $'--pretty=%Cred%h%Creset -%C(char lp)auto(char rp)%d%Creset %s %Cgreen(char lp)%ar(char rp) %C(char lp)bold blue(char rp)<%an>%Creset' --stat +export alias glom = git log --oneline --decorate $"(git_main_branch).." export alias gm = git merge export alias gmtl = git mergetool --no-prompt @@ -158,16 +183,34 @@ export alias grb = git rebase export alias grba = git rebase --abort export alias grbc = git rebase --continue export alias grbd = git rebase develop +export alias grbdi = git rebase develop --interactive +export alias grbdia = git rebase develop --interactive --autosquash export alias grbi = git rebase --interactive export alias grbm = git rebase (git_main_branch) +export alias grbmi = git rebase (git_main_branch) --interactive +export alias grbmia = git rebase (git_main_branch) --interactive --autosquash export alias grbo = git rebase --onto +export def grbom [] { + git fetch origin (git_main_branch) + git rebase FETCH_HEAD +} +export def grbomi [] { + git fetch origin (git_main_branch) + git rebase FETCH_HEAD --interactive +} +export def grbomia [] { + git fetch origin (git_main_branch) + git rebase FETCH_HEAD --interactive --autosquash +} export alias grbs = git rebase --skip export alias grev = git revert export alias grh = git reset export alias grhh = git reset --hard +export alias grhpa = git reset --patch export alias groh = git reset $"origin/(git_current_branch)" --hard export alias grm = git rm export alias grmc = git rm --cached +export alias grpo = git remote prune origin export def grmv [remote: string, new_name: string] { git remote rename $remote $new_name } @@ -205,6 +248,8 @@ export alias gsts = git stash show --text export alias gstu = gsta --include-untracked export alias gstall = git stash --all export alias gsu = git submodule update +export alias gsuri = git submodule update --recursive --init +export alias gsur = git submodule update --recursive export alias gsw = git switch export alias gswc = git switch --create @@ -237,6 +282,10 @@ export alias gwtmv = git worktree move export def gwtm [worktree: string] { git worktree remove $worktree } +export alias gwtrm = git worktree remove +export alias gwtlo = git worktree lock +export alias gwtpr = git worktree prune +export alias gwtulo = git worktree unlock export alias gam = git am export alias gamc = git am --continue