grt |
cd "$(git rev-parse --show-toplevel \|\| echo .)" |
Changes directory to the root directory of the current Git repository. |
ggpnp |
ggl && ggp |
Shortcut for executing ggl (Git Graph) and then ggp (Git Pull). |
ggpur |
ggu |
Shortcut for executing ggu (Git Pull Rebase). |
g |
git |
Abbreviation for the git command. |
ga |
git add |
Adds changes to the staging area. |
gaa |
git add --all |
Adds all changes, including untracked files, to the staging area. |
gapa |
git add --patch |
Starts adding changes interactively using patch mode. |
gau |
git add --update |
Adds changes to the staging area, excluding untracked files. |
gav |
git add --verbose |
Adds changes to the staging area in a verbose mode. |
gwip |
git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]" |
Stages all changes, removes deleted files, and commits with a message indicating a work-in-progress. |
gam |
git am |
Apply a series of patches from a mailbox. |
gama |
git am --abort |
Abort a git am operation and restores the original branch and index state. |
gamc |
git am --continue |
Continue a git am operation after resolving conflicts. |
gamscp |
git am --show-current-patch |
Show the current patch in a git am sequence. |
gams |
git am --skip |
Skip the current patch in a git am sequence. |
gap |
git apply |
Apply a patch to files and/or to the index. |
gapt |
git apply --3way |
Apply a patch with 3-way merge. |
gbs |
git bisect |
Use binary search to find the commit that introduced a bug. |
gbsb |
git bisect bad |
Mark the current commit as “bad” during a git bisect. |
gbsg |
git bisect good |
Mark the current commit as “good” during a git bisect. |
gbsn |
git bisect new |
Start a new git bisect session. |
gbso |
git bisect old |
Start a git bisect session from an old commit. |
gbsr |
git bisect reset |
Finish the current git bisect session and return to the original branch. |
gbss |
git bisect start |
Start a git bisect session. |
gbl |
git blame -w |
Show what revision and author last modified each line of a file. |
gb |
git branch |
List, create, or delete branches. |
gba |
git branch --all |
List all remote and local branches. |
gbd |
git branch --delete |
Delete a specified branch. |
gbD |
git branch --delete --force |
Force deletion of a specified branch. |
gbgd |
LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d |
Delete local branches that are remotely gone. |
gbgD |
LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D |
Force delete local branches that are remotely gone. |
gbm |
git branch --move |
Move/rename a branch. |
gbnm |
git branch --no-merged |
List branches that are not yet merged. |
gbr |
git branch --remote |
List remote branches. |
ggsup |
git branch --set-upstream-to=origin/$(git_current_branch) |
Set the upstream branch for the current branch. |
gbg |
LANG=C git branch -vv \| grep ": gone\]" |
List local branches that are remotely gone. |
gco |
git checkout |
Switch branches or restore working tree files. |
gcor |
git checkout --recurse-submodules |
Switch branches and recursively checkout submodules. |
gcb |
git checkout -b |
Create and switch to a new branch. |
gcd |
git checkout $(git_develop_branch) |
Switch to the develop branch. |
gcm |
git checkout $(git_main_branch) |
Switch to the main branch. |
gcp |
git cherry-pick |
Apply a commit from another branch. |
gcpa |
git cherry-pick --abort |
Abort the cherry-pick operation and return to the pre-cherry-pick state. |
gcpc |
git cherry-pick --continue |
Continue the cherry-pick operation after resolving conflicts. |
gclean |
git clean --interactive -d |
Remove untracked files and directories interactively. |
gcl |
git clone --recurse-submodules |
Clone a repository and initialize submodules. |
gccd |
git clone --recurse-submodules "$@" && cd "$(basename $\_ .git)" |
Clone a repository with submodules and change directory to the repository. |
gcam |
git commit --all --message |
Commit all changes with a specified message. |
gcas |
git commit --all --signoff |
Commit all changes and sign off on the commit. |
gcasm |
git commit --all --signoff --message |
Commit all changes with signoff and a specified message. |
gcmsg |
git commit --message |
Commit with a specified message. |
gcsm |
git commit --signoff --message |
Commit with signoff and a specified message. |
gc |
git commit --verbose |
Commit with a verbose output. |
gca |
git commit --verbose --all |
Commit all changes with a verbose output. |
gca! |
git commit --verbose --all --amend |
Amend the previous commit with a verbose output. |
gcan! |
git commit --verbose --all --no-edit --amend |
Amend the previous commit without changing the commit message. |
gcans! |
git commit --verbose --all --signoff --no-edit --amend |
Amend the previous commit with signoff without changing the commit message. |
gc! |
git commit --verbose --amend |
Amend the previous commit with a verbose output. |
gcn! |
git commit --verbose --no-edit --amend |
Amend the previous commit without changing the commit message. |
gcs |
git commit -S |
Commit with GPG signature. |
gcss |
git commit -S -s |
Commit with GPG signature and include the signoff. |
gcssm |
git commit -S -s -m |
Commit with GPG signature, signoff, and a specified message. |
gcf |
git config --list |
List all git configurations. |
gdct |
git describe --tags $(git rev-list --tags --max-count=1) |
Show the most recent tag reachable from a commit. |
gd |
git diff |
Show changes between commits, commit and working tree, etc. |
gdca |
git diff --cached |
Show changes between the index and the HEAD commit. |
gdcw |
git diff --cached --word-diff |
Show changes between the index and the HEAD commit with word-level diff. |
gds |
git diff --staged |
Show changes in the staging area. |
gdw |
git diff --word-diff |
Show changes in the working tree with word-level diff. |
gdv |
git diff -w "$@" \| view - |
Show changes in the working tree with word-level diff in a viewer. |
gdup |
git diff @{upstream} |
Show changes between the local branch and its upstream branch. |
gdnolock |
git diff $@ ":(exclude)package-lock.json" ":(exclude)\*.lock" |
Show changes excluding specific file patterns. |
gdt |
git diff-tree --no-commit-id --name-only -r |
Show names of changed files given two commit IDs. |
gf |
git fetch |
Download objects and refs from another repository. |
gfa |
git fetch --all --prune |
Fetch all remotes and prune references to deleted branches. |
gfo |
git fetch origin |
Fetch from the remote named origin. |
gg |
git gui citool |
Start the Git GUI citool interface. |
gga |
git gui citool --amend |
Start the Git GUI citool interface for amending changes. |
ghh |
git help |
Show help information about Git. |
glgg |
git log --graph |
Show the commit history with a text-based graph. |
glgga |
git log --graph --decorate --all |
Show the commit history with a decorated graph and all branches. |
glgm |
git log --graph --max-count=10 |
Show the commit history with a graph limited to 10 commits. |
glod |
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' |
Show the commit history with a decorated graph and date. |
glods |
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short |
Show the commit history with a decorated graph, date in short format. |
glol |
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' |
Show the commit history with a decorated graph and relative date. |
glola |
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --all |
Show the commit history with a decorated graph, relative date, and all references. |
glols |
git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --stat |
Show the commit history with a decorated graph, relative date, and file stats. |
glo |
git log --oneline --decorate |
Show the commit history in one line with decorations. |
glog |
git log --oneline --decorate --graph |
Show the commit history in one line with decorations and a graph. |
gloga |
git log --oneline --decorate --graph --all |
Show the commit history in one line with decorations, a graph, and all references. |
glp |
git log --pretty=<format> |
Show the commit history with custom-defined format. |
glg |
git log --stat |
Show the commit history with stats. |
glgp |
git log --stat --patch |
Show the commit history with stats and patch information. |
gignored |
git ls-files -v \| grep "^[[:lower:]]" |
List ignored files in the repository. |
gfg |
git ls-files \| grep |
Search for files in the repository. |
gm |
git merge |
Merge changes from another branch into the current branch. |
gma |
git merge --abort |
Abort an ongoing merge operation. |
gms |
git merge --squash |
Merge changes but do not commit the result. |
gmom |
git merge origin/$(git_main_branch) |
Merge changes from the main branch of the origin repository into the current branch. |
gmum |
git merge upstream/$(git_main_branch) |
Merge changes from the main branch of the upstream repository into the current branch. |
gmtl |
git mergetool --no-prompt |
Launch the merge tool to resolve conflicts without prompts. |
gmtlvim |
git mergetool --no-prompt --tool=vimdiff |
Launch Vim as the merge tool to resolve conflicts without prompts. |
gl |
git pull |
Fetch and integrate changes from a remote repository into the current branch. |
gpr |
git pull --rebase |
Fetch changes and rebase the current branch onto the fetched changes. |
gprv |
git pull --rebase -v |
Fetch changes, rebase with verbose output. |
gpra |
git pull --rebase --autostash |
Fetch changes, rebase, and stash local modifications automatically. |
gprav |
git pull --rebase --autostash -v |
Fetch changes, rebase with verbose output, and stash local modifications automatically. |
gprom |
git pull --rebase origin $(git_main_branch) |
Fetch changes from the main branch of the origin repository and rebase onto it. |
gpromi |
git pull --rebase=interactive origin $(git_main_branch) |
Fetch changes from the main branch of the origin repository and rebase interactively onto it. |
ggpull |
git pull origin "$(git_current_branch)" |
Pull changes from the current branch on the remote repository to the current local branch. |
ggl |
git pull origin $(current_branch) |
Pull changes from the current branch on the remote repository to the current local branch. |
gluc |
git pull upstream $(git_current_branch) |
Pull changes from the current branch on the upstream repository to the current local branch. |
glum |
git pull upstream $(git_main_branch) |
Pull changes from the main branch on the upstream repository to the current local branch. |
gp |
git push |
Update remote references along with associated objects. |
gpd |
git push --dry-run |
Simulate a push operation, showing what would be pushed. |
gpf! |
git push --force |
Forcefully push commits to the remote repository, overwriting history. |
ggf |
git push --force origin $(current_branch) |
Forcefully push the current local branch to the remote repository, overwriting history. |
gpf |
On Git >= 2.30: git push --force-with-lease --force-if-includes |
Safely force-push commits by considering the remote state. |
|
On Git < 2.30: git push --force-with-lease |
Safely force-push commits by considering the remote state (for versions earlier than Git 2.30). |
ggfl |
git push --force-with-lease origin $(current_branch) |
Safely force-push the current local branch to the remote repository, considering the remote state. |
gpsup |
git push --set-upstream origin $(git_current_branch) |
Push changes and set the upstream reference for the current branch on the remote repository. |
gpsupf |
On Git >= 2.30: git push --set-upstream origin $(git_current_branch) --force-with-lease --force-if-includes |
Push changes and set the upstream reference for the current branch, safely considering the remote state. |
|
On Git < 2.30: git push --set-upstream origin $(git_current_branch) --force-with-lease |
Push changes and set the upstream reference for the current branch, safely considering the remote state (for versions earlier than Git 2.30). |
gpv |
git push --verbose |
Push changes to the remote repository with verbose output. |
gpoat |
git push origin --all && git push origin --tags |
Push all branches and tags to the remote repository. |
gpod |
git push origin --delete |
Delete a branch on the remote repository. |
ggpush |
git push origin "$(git_current_branch)" |
Push the current branch to the remote repository. |
ggp |
git push origin $(current_branch) |
Push the current branch to the remote repository. |
gpu |
git push upstream |
Push changes to the upstream repository. |
grb |
git rebase |
Reapply commits on top of another base tip. |
grba |
git rebase --abort |
Abort an ongoing rebase operation. |
grbc |
git rebase --continue |
Continue a rebase operation after resolving conflicts. |
grbi |
git rebase --interactive |
Rebase interactively to modify commit history. |
grbo |
git rebase --onto |
Rebase onto a new base. |
grbs |
git rebase --skip |
Skip applying a commit during a rebase operation. |
grbd |
git rebase $(git_develop_branch) |
Rebase changes from the development branch onto the current branch. |
grbm |
git rebase $(git_main_branch) |
Rebase changes from the main branch onto the current branch. |
grbom |
git rebase origin/$(git_main_branch) |
Rebase changes from the main branch of the origin repository onto the current branch. |
gr |
git remote |
Manage set of tracked repositories. |
grv |
git remote --verbose |
List remote repositories with URLs after each name. |
gra |
git remote add |
Add a new remote. |
grrm |
git remote remove |
Remove a remote. |
grmv |
git remote rename |
Rename a remote. |
grset |
git remote set-url |
Set URLs of a remote. |
grup |
git remote update |
Fetch updates from a remote. |
grh |
git reset |
Reset current HEAD to the specified state. |
gru |
git reset -- |
Reset current HEAD to the last commit, keeping changes unstaged. |
grhh |
git reset --hard |
Reset current HEAD to the specified state, discarding changes. |
grhk |
git reset --keep |
Reset current HEAD to a commit, keeping changes in the working directory. |
grhs |
git reset --soft |
Reset current HEAD to a commit, keeping changes staged. |
gpristine |
git reset --hard && git clean -dffx |
Reset to HEAD and remove untracked files and directories. |
groh |
git reset origin/$(git_current_branch) --hard |
Reset to the state of the current branch in the origin repository. |
grs |
git restore |
Restore working tree files. |
grss |
git restore --source |
Restore files from a given source. |
grst |
git restore --staged |
Unstage changes from the staging area. |
gunwip |
git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1 |
Undo the last commit if the commit message includes “–wip–”. |
grev |
git revert |
Revert changes made in a commit or a range of commits. |
grm |
git rm |
Remove files from the working tree and from the index. |
grmc |
git rm --cached |
Remove files from the index, but keep them in the working directory. |
gcount |
git shortlog --summary -n |
Count commits by each contributor. |
gsh |
git show |
Show various types of objects. |
gsps |
git show --pretty=short --show-signature |
Show a short format with GPG signature information. |
gstall |
git stash --all |
Stash changes including untracked files. |
gstu |
git stash --include-untracked |
Stash changes including untracked files. |
gstaa |
git stash apply |
Apply the latest stash. |
gstc |
git stash clear |
Remove all stashed entries. |
gstd |
git stash drop |
Drop a specific stash. |
gstl |
git stash list |
List all stashes. |
gstp |
git stash pop |
Apply and remove a stash from the stack. |
gsta |
On Git >= 2.13: git stash push |
Stash changes in the working directory. |
gsta |
On Git < 2.13: git stash save |
Stash changes in the working directory. |
gsts |
git stash show --patch |
Show content changes of a stash. |
gst |
git status |
Show the working tree status. |
gss |
git status --short |
Show the short status of the working tree. |
gsb |
git status --short -b |
Show the short status of the working tree along with the branch name. |
gsi |
git submodule init |
Initialize submodules in the repository. |
gsu |
git submodule update |
Update registered submodules to match the specified commit. |
gsd |
git svn dcommit |
Commit to an SVN repository using git. |
git-svn-dcommit-push |
git svn dcommit && git push github $(git_main_branch):svntrunk |
Commit changes to an SVN repository and push to GitHub. |
gsr |
git svn rebase |
Rebase the current branch onto the SVN remote branch. |
gsw |
git switch |
Switch branches or restore working tree files. |
gswc |
git switch -c |
Create and switch to a new branch. |
gswd |
git switch $(git_develop_branch) |
Switch to the development branch. |
gswm |
git switch $(git_main_branch) |
Switch to the main branch. |
gta |
git tag --annotate |
Create an annotated tag. |
gts |
git tag -s |
Create a signed tag. |
gtv |
git tag \| sort -V |
List tags sorted by version. |
gignore |
git update-index --assume-unchanged |
Ignore changes to a tracked file. |
gunignore |
git update-index --no-assume-unchanged |
Stop ignoring changes to a tracked file. |
gwch |
git whatchanged -p --abbrev-commit --pretty=medium |
Show logs with content differences, abbreviating commit IDs and using a medium output format. |
gwt |
git worktree |
Manage multiple working trees. |
gwtls |
git worktree list |
List all linked working trees. |
gwtmv |
git worktree move |
Move a working tree to a new path. |
gwtrm |
git worktree remove |
Remove a working tree. |
gk |
gitk --all --branches &! |
Open gitk showing all branches. |
gke |
gitk --all $(git log --walk-reflogs --pretty=%h) &! |
Open gitk showing all history, including reflogs. |
gtl |
gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl |
List tags, sorted by version, and filter by provided prefix. |