Update README.md with description of git commands

added description of git commands
This commit is contained in:
Jayakrishnan C N 2025-09-10 16:31:43 +05:30 committed by GitHub
commit 0be2ca6d6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,217 +10,217 @@ plugins=(... git)
## Aliases ## Aliases
| Alias | Command | | Alias | Command | Description |
| :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ | | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------- |
| `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` | | `grt` | `cd "$(git rev-parse --show-toplevel \|\| echo .)"` | Navigate to the root directory of the current git repository |
| `ggpnp` | `ggl && ggp` | | `ggpnp` | `ggl && ggp` | Pull from origin and then push to origin (pull and push) |
| `ggpur` | `ggu` | | `ggpur` | `ggu` | Pull with rebase from upstream |
| `g` | `git` | | `g` | `git` | Short alias for git command |
| `ga` | `git add` | | `ga` | `git add` | Add files to the staging area |
| `gaa` | `git add --all` | | `gaa` | `git add --all` | Add all changes (including new, modified, and deleted files) to staging area |
| `gapa` | `git add --patch` | | `gapa` | `git add --patch` | Interactively add changes to staging area by selecting hunks |
| `gau` | `git add --update` | | `gau` | `git add --update` | Add only modified and deleted files to staging area (no new files) |
| `gav` | `git add --verbose` | | `gav` | `git add --verbose` | Add files to staging area with verbose output showing what was added |
| `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` | | `gwip` | `git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"` | Create a work-in-progress commit with all changes and skip CI |
| `gam` | `git am` | | `gam` | `git am` | Apply patches from mailbox format |
| `gama` | `git am --abort` | | `gama` | `git am --abort` | Abort the current patch application process |
| `gamc` | `git am --continue` | | `gamc` | `git am --continue` | Continue applying patches after resolving conflicts |
| `gamscp` | `git am --show-current-patch` | | `gamscp` | `git am --show-current-patch` | Show the current patch being applied |
| `gams` | `git am --skip` | | `gams` | `git am --skip` | Skip the current patch and continue with the next one |
| `gap` | `git apply` | | `gap` | `git apply` | Apply a patch to files and/or to the index |
| `gapt` | `git apply --3way` | | `gapt` | `git apply --3way` | Apply patch using 3-way merge when conflicts occur |
| `gbs` | `git bisect` | | `gbs` | `git bisect` | Start or manage binary search to find problematic commit |
| `gbsb` | `git bisect bad` | | `gbsb` | `git bisect bad` | Mark current commit as bad during bisect |
| `gbsg` | `git bisect good` | | `gbsg` | `git bisect good` | Mark current commit as good during bisect |
| `gbsn` | `git bisect new` | | `gbsn` | `git bisect new` | Mark current commit as new (bad) during bisect |
| `gbso` | `git bisect old` | | `gbso` | `git bisect old` | Mark current commit as old (good) during bisect |
| `gbsr` | `git bisect reset` | | `gbsr` | `git bisect reset` | End bisect session and return to original branch |
| `gbss` | `git bisect start` | | `gbss` | `git bisect start` | Start a new bisect session |
| `gbl` | `git blame -w` | | `gbl` | `git blame -w` | Show who last modified each line of a file, ignoring whitespace changes |
| `gb` | `git branch` | | `gb` | `git branch` | List, create, or delete branches |
| `gba` | `git branch --all` | | `gba` | `git branch --all` | List all branches (local and remote) |
| `gbd` | `git branch --delete` | | `gbd` | `git branch --delete` | Delete a branch (safe delete, only if merged) |
| `gbD` | `git branch --delete --force` | | `gbD` | `git branch --delete --force` | Force delete a branch regardless of merge status |
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` | | `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` | Delete local branches that track deleted remote branches (safe delete) |
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` | | `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` | Force delete local branches that track deleted remote branches |
| `gbm` | `git branch --move` | | `gbm` | `git branch --move` | Rename/move a branch |
| `gbnm` | `git branch --no-merged` | | `gbnm` | `git branch --no-merged` | List branches that are not merged into current branch |
| `gbr` | `git branch --remote` | | `gbr` | `git branch --remote` | List remote-tracking branches |
| `ggsup` | `git branch --set-upstream-to=origin/$(git_current_branch)` | | `ggsup` | `git branch --set-upstream-to=origin/$(git_current_branch)` | Set upstream tracking for current branch to origin |
| `gbg` | `LANG=C git branch -vv \| grep ": gone\]"` | | `gbg` | `LANG=C git branch -vv \| grep ": gone\]"` | Show local branches that track deleted remote branches |
| `gco` | `git checkout` | | `gco` | `git checkout` | Switch branches or restore working tree files |
| `gcor` | `git checkout --recurse-submodules` | | `gcor` | `git checkout --recurse-submodules` | Checkout and recursively update submodules |
| `gcb` | `git checkout -b` | | `gcb` | `git checkout -b` | Create and switch to a new branch |
| `gcB` | `git checkout -B` | | `gcB` | `git checkout -B` | Create or reset and switch to a branch |
| `gcd` | `git checkout $(git_develop_branch)` | | `gcd` | `git checkout $(git_develop_branch)` | Switch to the development branch (dev, devel, development, or develop) |
| `gcm` | `git checkout $(git_main_branch)` | | `gcm` | `git checkout $(git_main_branch)` | Switch to the main branch (main or master) |
| `gcp` | `git cherry-pick` | | `gcp` | `git cherry-pick` | Apply commits from another branch to current branch |
| `gcpa` | `git cherry-pick --abort` | | `gcpa` | `git cherry-pick --abort` | Abort cherry-pick operation |
| `gcpc` | `git cherry-pick --continue` | | `gcpc` | `git cherry-pick --continue` | Continue cherry-pick after resolving conflicts |
| `gclean` | `git clean --interactive -d` | | `gclean` | `git clean --interactive -d` | Interactively remove untracked files and directories |
| `gcl` | `git clone --recurse-submodules` | | `gcl` | `git clone --recurse-submodules` | Clone a repository and recursively clone its submodules |
| `gclf` | `git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules` | | `gclf` | `git clone --recursive --shallow-submodules --filter=blob:none --also-filter-submodules` | Clone repository with filtered blobs and shallow submodules for faster cloning |
| `gccd` | `git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)"` | | `gccd` | `git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)"` | Clone repository with submodules and change to the cloned directory |
| `gcam` | `git commit --all --message` | | `gcam` | `git commit --all --message` | Commit all changes with a message |
| `gcas` | `git commit --all --signoff` | | `gcas` | `git commit --all --signoff` | Commit all changes and add signed-off-by line |
| `gcasm` | `git commit --all --signoff --message` | | `gcasm` | `git commit --all --signoff --message` | Commit all changes with message and signed-off-by line |
| `gcmsg` | `git commit --message` | | `gcmsg` | `git commit --message` | Create a commit with a message |
| `gcsm` | `git commit --signoff --message` | | `gcsm` | `git commit --signoff --message` | Create a commit with message and signed-off-by line |
| `gc` | `git commit --verbose` | | `gc` | `git commit --verbose` | Create a commit with verbose output showing diff |
| `gca` | `git commit --verbose --all` | | `gca` | `git commit --verbose --all` | Commit all changes with verbose output |
| `gca!` | `git commit --verbose --all --amend` | | `gca!` | `git commit --verbose --all --amend` | Amend last commit with all current changes and verbose output |
| `gcan!` | `git commit --verbose --all --no-edit --amend` | | `gcan!` | `git commit --verbose --all --no-edit --amend` | Amend last commit with all changes without editing message |
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` | | `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` | Amend last commit with all changes, add sign-off, no edit |
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` | | `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` | Amend last commit with current timestamp, all changes, no edit |
| `gc!` | `git commit --verbose --amend` | | `gc!` | `git commit --verbose --amend` | Amend last commit with verbose output |
| `gcn` | `git commit --verbose --no-edit` | | `gcn` | `git commit --verbose --no-edit` | Create commit with verbose output but no editor |
| `gcn!` | `git commit --verbose --no-edit --amend` | | `gcn!` | `git commit --verbose --no-edit --amend` | Amend last commit without opening editor |
| `gcs` | `git commit -S` | | `gcs` | `git commit -S` | Create a GPG-signed commit |
| `gcss` | `git commit -S -s` | | `gcss` | `git commit -S -s` | Create a GPG-signed commit with sign-off |
| `gcssm` | `git commit -S -s -m` | | `gcssm` | `git commit -S -s -m` | Create a GPG-signed commit with sign-off and message |
| `gcf` | `git config --list` | | `gcf` | `git config --list` | List all git configuration settings |
| `gcfu` | `git commit --fixup` | | `gcfu` | `git commit --fixup` | Create a fixup commit for later use with rebase --autosquash |
| `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` | | `gdct` | `git describe --tags $(git rev-list --tags --max-count=1)` | Show the most recent tag |
| `gd` | `git diff` | | `gd` | `git diff` | Show changes between working directory and staging area |
| `gdca` | `git diff --cached` | | `gdca` | `git diff --cached` | Show changes between staging area and last commit |
| `gdcw` | `git diff --cached --word-diff` | | `gdcw` | `git diff --cached --word-diff` | Show word-level changes between staging area and last commit |
| `gds` | `git diff --staged` | | `gds` | `git diff --staged` | Show changes between staging area and last commit (same as gdca) |
| `gdw` | `git diff --word-diff` | | `gdw` | `git diff --word-diff` | Show word-level changes between working directory and staging area |
| `gdv` | `git diff -w "$@" \| view -` | | `gdv` | `git diff -w "$@" \| view -` | Show diff ignoring whitespace and pipe to view |
| `gdup` | `git diff @{upstream}` | | `gdup` | `git diff @{upstream}` | Show diff between current branch and its upstream |
| `gdnolock` | `git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock"` | | `gdnolock` | `git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock"` | Show diff excluding lock files |
| `gdt` | `git diff-tree --no-commit-id --name-only -r` | | `gdt` | `git diff-tree --no-commit-id --name-only -r` | Show only the names of changed files in a commit |
| `gf` | `git fetch` | | `gf` | `git fetch` | Download objects and refs from remote repository |
| `gfa` | `git fetch --all --tags --prune` | | `gfa` | `git fetch --all --tags --prune` | Fetch from all remotes, download tags, and prune deleted branches |
| `gfo` | `git fetch origin` | | `gfo` | `git fetch origin` | Fetch from origin remote |
| `gg` | `git gui citool` | | `gg` | `git gui citool` | Open git GUI commit tool |
| `gga` | `git gui citool --amend` | | `gga` | `git gui citool --amend` | Open git GUI commit tool to amend last commit |
| `ghh` | `git help` | | `ghh` | `git help` | Show git help documentation |
| `glgg` | `git log --graph` | | `glgg` | `git log --graph` | Show commit history as a graph |
| `glgga` | `git log --graph --decorate --all` | | `glgga` | `git log --graph --decorate --all` | Show commit history graph with decorations for all branches |
| `glgm` | `git log --graph --max-count=10` | | `glgm` | `git log --graph --max-count=10` | Show last 10 commits as a graph |
| `glod` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'` | | `glod` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'` | Show commit log with colored format including absolute dates |
| `glods` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short` | | `glods` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short` | Show commit log with colored format and short dates |
| `glol` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'` | | `glol` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'` | Show commit log with colored format including relative dates |
| `glola` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all` | | `glola` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all` | Show commit log with colored format for all branches |
| `glols` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat` | | `glols` | `git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat` | Show commit log with colored format and file change statistics |
| `glo` | `git log --oneline --decorate` | | `glo` | `git log --oneline --decorate` | Show compact one-line commit history with decorations |
| `glog` | `git log --oneline --decorate --graph` | | `glog` | `git log --oneline --decorate --graph` | Show compact one-line commit history as a graph |
| `gloga` | `git log --oneline --decorate --graph --all` | | `gloga` | `git log --oneline --decorate --graph --all` | Show compact one-line commit history graph for all branches |
| `glp` | `git log --pretty=<format>` | | `glp` | `git log --pretty=<format>` | Show commit log with custom pretty format |
| `glg` | `git log --stat` | | `glg` | `git log --stat` | Show commit history with file change statistics |
| `glgp` | `git log --stat --patch` | | `glgp` | `git log --stat --patch` | Show commit history with statistics and full patch content |
| `gignored` | `git ls-files -v \| grep "^[[:lower:]]"` | | `gignored` | `git ls-files -v \| grep "^[[:lower:]]"` | List files that are ignored or assume-unchanged |
| `gfg` | `git ls-files \| grep` | | `gfg` | `git ls-files \| grep` | Search for files in git repository by pattern |
| `gm` | `git merge` | | `gm` | `git merge` | Merge branches together |
| `gma` | `git merge --abort` | | `gma` | `git merge --abort` | Abort current merge operation |
| `gmc` | `git merge --continue` | | `gmc` | `git merge --continue` | Continue merge after resolving conflicts |
| `gms` | `git merge --squash` | | `gms` | `git merge --squash` | Merge branch and squash commits into single commit |
| `gmff` | `git merge --ff-only` | | `gmff` | `git merge --ff-only` | Merge only if fast-forward is possible |
| `gmom` | `git merge origin/$(git_main_branch)` | | `gmom` | `git merge origin/$(git_main_branch)` | Merge origin's main branch into current branch |
| `gmum` | `git merge upstream/$(git_main_branch)` | | `gmum` | `git merge upstream/$(git_main_branch)` | Merge upstream's main branch into current branch |
| `gmtl` | `git mergetool --no-prompt` | | `gmtl` | `git mergetool --no-prompt` | Run merge tool without prompting |
| `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` | | `gmtlvim` | `git mergetool --no-prompt --tool=vimdiff` | Run vimdiff as merge tool without prompting |
| `gl` | `git pull` | | `gl` | `git pull` | Pull changes from remote repository |
| `gpr` | `git pull --rebase` | | `gpr` | `git pull --rebase` | Pull and rebase instead of merge |
| `gprv` | `git pull --rebase -v` | | `gprv` | `git pull --rebase -v` | Pull and rebase with verbose output |
| `gpra` | `git pull --rebase --autostash` | | `gpra` | `git pull --rebase --autostash` | Pull and rebase with automatic stashing of local changes |
| `gprav` | `git pull --rebase --autostash -v` | | `gprav` | `git pull --rebase --autostash -v` | Pull and rebase with autostash and verbose output |
| `gprom` | `git pull --rebase origin $(git_main_branch)` | | `gprom` | `git pull --rebase origin $(git_main_branch)` | Pull and rebase from origin's main branch |
| `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` | | `gpromi` | `git pull --rebase=interactive origin $(git_main_branch)` | Interactive pull and rebase from origin's main branch |
| `gprum` | `git pull --rebase upstream $(git_main_branch)` | | `gprum` | `git pull --rebase upstream $(git_main_branch)` | Pull and rebase from upstream's main branch |
| `gprumi` | `git pull --rebase=interactive upstream $(git_main_branch)` | | `gprumi` | `git pull --rebase=interactive upstream $(git_main_branch)` | Interactive pull and rebase from upstream's main branch |
| `ggpull` | `git pull origin "$(git_current_branch)"` | | `ggpull` | `git pull origin "$(git_current_branch)"` | Pull from origin using current branch name |
| `ggl` | `git pull origin $(current_branch)` | | `ggl` | `git pull origin $(current_branch)` | Pull from origin for current branch |
| `gluc` | `git pull upstream $(git_current_branch)` | | `gluc` | `git pull upstream $(git_current_branch)` | Pull from upstream for current branch |
| `glum` | `git pull upstream $(git_main_branch)` | | `glum` | `git pull upstream $(git_main_branch)` | Pull from upstream's main branch |
| `gp` | `git push` | | `gp` | `git push` | Push commits to remote repository |
| `gpd` | `git push --dry-run` | | `gpd` | `git push --dry-run` | Show what would be pushed without actually pushing |
| `gpf!` | `git push --force` | | `gpf!` | `git push --force` | Force push (dangerous - rewrites remote history) |
| `ggf` | `git push --force origin $(current_branch)` | | `ggf` | `git push --force origin $(current_branch)` | Force push current branch to origin |
| `gpf` | On Git >= 2.30: `git push --force-with-lease --force-if-includes` | | `gpf` | On Git >= 2.30: `git push --force-with-lease --force-if-includes` | Safer force push that checks if remote was updated |
| `gpf` | On Git < 2.30: `git push --force-with-lease` | | `gpf` | On Git < 2.30: `git push --force-with-lease` | Safer force push that checks if remote was updated (older git) |
| `ggfl` | `git push --force-with-lease origin $(current_branch)` | | `ggfl` | `git push --force-with-lease origin $(current_branch)` | Force push current branch with lease protection |
| `gpsup` | `git push --set-upstream origin $(git_current_branch)` | | `gpsup` | `git push --set-upstream origin $(git_current_branch)` | Push and set upstream tracking for current branch |
| `gpsupf` | On Git >= 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes` | | `gpsupf` | On Git >= 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes` | Push with upstream and force-with-lease protection |
| `gpsupf` | On Git < 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease` | | `gpsupf` | On Git < 2.30: `git push --set-upstream origin $(git_current_branch) --force-with-lease` | Push with upstream and force-with-lease protection (older git) |
| `gpv` | `git push --verbose` | | `gpv` | `git push --verbose` | Push with verbose output |
| `gpoat` | `git push origin --all && git push origin --tags` | | `gpoat` | `git push origin --all && git push origin --tags` | Push all branches and tags to origin |
| `gpod` | `git push origin --delete` | | `gpod` | `git push origin --delete` | Delete a branch or tag on origin remote |
| `ggpush` | `git push origin "$(git_current_branch)"` | | `ggpush` | `git push origin "$(git_current_branch)"` | Push current branch to origin |
| `ggp` | `git push origin $(current_branch)` | | `ggp` | `git push origin $(current_branch)` | Push current branch to origin |
| `gpu` | `git push upstream` | | `gpu` | `git push upstream` | Push to upstream remote |
| `grb` | `git rebase` | | `grb` | `git rebase` | Reapply commits on top of another base tip |
| `grba` | `git rebase --abort` | | `grba` | `git rebase --abort` | Abort current rebase operation |
| `grbc` | `git rebase --continue` | | `grbc` | `git rebase --continue` | Continue rebase after resolving conflicts |
| `grbi` | `git rebase --interactive` | | `grbi` | `git rebase --interactive` | Start interactive rebase to edit commits |
| `grbo` | `git rebase --onto` | | `grbo` | `git rebase --onto` | Rebase commits onto a specific commit |
| `grbs` | `git rebase --skip` | | `grbs` | `git rebase --skip` | Skip current commit during rebase |
| `grbd` | `git rebase $(git_develop_branch)` | | `grbd` | `git rebase $(git_develop_branch)` | Rebase current branch onto development branch |
| `grbm` | `git rebase $(git_main_branch)` | | `grbm` | `git rebase $(git_main_branch)` | Rebase current branch onto main branch |
| `grbom` | `git rebase origin/$(git_main_branch)` | | `grbom` | `git rebase origin/$(git_main_branch)` | Rebase current branch onto origin's main branch |
| `grbum` | `git rebase upstream/$(git_main_branch)` | | `grbum` | `git rebase upstream/$(git_main_branch)` | Rebase current branch onto upstream's main branch |
| `grf` | `git reflog` | | `grf` | `git reflog` | Show reference logs (history of branch tips) |
| `gr` | `git remote` | | `gr` | `git remote` | List remote repositories |
| `grv` | `git remote --verbose` | | `grv` | `git remote --verbose` | List remote repositories with URLs |
| `gra` | `git remote add` | | `gra` | `git remote add` | Add a new remote repository |
| `grrm` | `git remote remove` | | `grrm` | `git remote remove` | Remove a remote repository |
| `grmv` | `git remote rename` | | `grmv` | `git remote rename` | Rename a remote repository |
| `grset` | `git remote set-url` | | `grset` | `git remote set-url` | Change URL of a remote repository |
| `grup` | `git remote update` | | `grup` | `git remote update` | Update all remote-tracking branches |
| `grh` | `git reset` | | `grh` | `git reset` | Reset current HEAD to specified state |
| `gru` | `git reset --` | | `gru` | `git reset --` | Unstage files (reset from staging area) |
| `grhh` | `git reset --hard` | | `grhh` | `git reset --hard` | Reset working directory and staging area to match commit |
| `grhk` | `git reset --keep` | | `grhk` | `git reset --keep` | Reset HEAD but keep local changes |
| `grhs` | `git reset --soft` | | `grhs` | `git reset --soft` | Reset HEAD but keep staging area and working directory |
| `gpristine` | `git reset --hard && git clean --force -dfx` | | `gpristine` | `git reset --hard && git clean --force -dfx` | Reset to clean state, removing all untracked files and changes |
| `gwipe` | `git reset --hard && git clean --force -df` | | `gwipe` | `git reset --hard && git clean --force -df` | Reset and clean working directory (keeping ignored files) |
| `groh` | `git reset origin/$(git_current_branch) --hard` | | `groh` | `git reset origin/$(git_current_branch) --hard` | Hard reset to match origin's version of current branch |
| `grs` | `git restore` | | `grs` | `git restore` | Restore working tree files |
| `grss` | `git restore --source` | | `grss` | `git restore --source` | Restore files from a specific source |
| `grst` | `git restore --staged` | | `grst` | `git restore --staged` | Unstage files (restore from staging area) |
| `gunwip` | `git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1` | | `gunwip` | `git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1` | Remove work-in-progress commit if it exists |
| `grev` | `git revert` | | `grev` | `git revert` | Create new commit that undoes changes from previous commits |
| `grm` | `git rm` | | `grm` | `git rm` | Remove files from working tree and staging area |
| `grmc` | `git rm --cached` | | `grmc` | `git rm --cached` | Remove files from staging area but keep in working directory |
| `gcount` | `git shortlog --summary -n` | | `gcount` | `git shortlog --summary -n` | Show commit count by author, sorted by number of commits |
| `gsh` | `git show` | | `gsh` | `git show` | Show information about commits, tags, or other objects |
| `gsps` | `git show --pretty=short --show-signature` | | `gsps` | `git show --pretty=short --show-signature` | Show commit with short format and signature verification |
| `gstall` | `git stash --all` | | `gstall` | `git stash --all` | Stash all changes including untracked and ignored files |
| `gstu` | `git stash --include-untracked` | | `gstu` | `git stash --include-untracked` | Stash changes including untracked files |
| `gstaa` | `git stash apply` | | `gstaa` | `git stash apply` | Apply most recent stash without removing it |
| `gstc` | `git stash clear` | | `gstc` | `git stash clear` | Delete all stashes |
| `gstd` | `git stash drop` | | `gstd` | `git stash drop` | Delete most recent stash |
| `gstl` | `git stash list` | | `gstl` | `git stash list` | List all stashes |
| `gstp` | `git stash pop` | | `gstp` | `git stash pop` | Apply and remove most recent stash |
| `gsta` | On Git >= 2.13: `git stash push` | | `gsta` | On Git >= 2.13: `git stash push` | Create a new stash with optional message and pathspec |
| `gsta` | On Git < 2.13: `git stash save` | | `gsta` | On Git < 2.13: `git stash save` | Create a new stash with message (older git versions) |
| `gsts` | `git stash show --patch` | | `gsts` | `git stash show --patch` | Show changes in most recent stash as a patch |
| `gst` | `git status` | | `gst` | `git status` | Show working tree status |
| `gss` | `git status --short` | | `gss` | `git status --short` | Show working tree status in short format |
| `gsb` | `git status --short -b` | | `gsb` | `git status --short -b` | Show short status with branch information |
| `gsi` | `git submodule init` | | `gsi` | `git submodule init` | Initialize git submodules |
| `gsu` | `git submodule update` | | `gsu` | `git submodule update` | Update git submodules to match superproject |
| `gsd` | `git svn dcommit` | | `gsd` | `git svn dcommit` | Commit to SVN repository (git-svn) |
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` | | `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` | Commit to SVN and push to GitHub |
| `gsr` | `git svn rebase` | | `gsr` | `git svn rebase` | Rebase from SVN repository (git-svn) |
| `gsw` | `git switch` | | `gsw` | `git switch` | Switch to a different branch |
| `gswc` | `git switch -c` | | `gswc` | `git switch -c` | Create and switch to a new branch |
| `gswd` | `git switch $(git_develop_branch)` | | `gswd` | `git switch $(git_develop_branch)` | Switch to development branch |
| `gswm` | `git switch $(git_main_branch)` | | `gswm` | `git switch $(git_main_branch)` | Switch to main branch |
| `gta` | `git tag --annotate` | | `gta` | `git tag --annotate` | Create an annotated tag |
| `gts` | `git tag -s` | | `gts` | `git tag -s` | Create a GPG-signed tag |
| `gtv` | `git tag \| sort -V` | | `gtv` | `git tag \| sort -V` | List tags sorted by version numbers |
| `gignore` | `git update-index --assume-unchanged` | | `gignore` | `git update-index --assume-unchanged` | Mark files as unchanged to ignore local modifications |
| `gunignore` | `git update-index --no-assume-unchanged` | | `gunignore` | `git update-index --no-assume-unchanged` | Stop ignoring local modifications to files |
| `gwch` | `git whatchanged -p --abbrev-commit --pretty=medium` | | `gwch` | `git whatchanged -p --abbrev-commit --pretty=medium` | Show commit history with patches and abbreviated commit hashes |
| `gwt` | `git worktree` | | `gwt` | `git worktree` | Manage multiple working trees |
| `gwtls` | `git worktree list` | | `gwtls` | `git worktree list` | List all working trees |
| `gwtmv` | `git worktree move` | | `gwtmv` | `git worktree move` | Move a working tree to a new location |
| `gwtrm` | `git worktree remove` | | `gwtrm` | `git worktree remove` | Remove a working tree |
| `gk` | `gitk --all --branches &!` | | `gk` | `gitk --all --branches &!` | Open gitk GUI showing all branches in background |
| `gke` | `gitk --all $(git log --walk-reflogs --pretty=%h) &!` | | `gke` | `gitk --all $(git log --walk-reflogs --pretty=%h) &!` | Open gitk GUI showing all reflog entries in background |
| `gtl` | `gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl` | | `gtl` | `gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl` | List tags matching pattern, sorted by version in descending order |
### Main branch preference ### Main branch preference