diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 0803dee2eb..c0d33b5225 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -2,129 +2,114 @@ cite 'about-alias' about-alias 'common git abbreviations' # Aliases -alias gcl='git clone' +alias g='git' alias ga='git add' -alias grm='git rm' -alias gap='git add -p' alias gall='git add -A' +alias gap='git add -p' +alias gb='git branch' +alias gbD='git branch -D' +alias gba='git branch -a' +alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' # FROM https://stackoverflow.com/a/58623139/10362396 +alias gbd='git branch -d' +alias gbm='git branch -m' +alias gbt='git branch --track' +alias gc='git commit -v' +alias gca='git commit -v -a' +alias gcaa='git commit -a --amend -C HEAD' # Add uncommitted and unstaged changes to the last commit +alias gcam='git commit -v -am' +alias gcamd='git commit --amend' +alias gcb='git checkout -b' +alias gci='git commit --interactive' +alias gcl='git clone' +alias gclean='git clean -fd' +alias gcm='git commit -v -m' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gcom='git checkout master' +alias gcount='git shortlog -sn' +alias gcp='git cherry-pick' +alias gcpd='git checkout master; git pull; git branch -D' +alias gcpx='git cherry-pick -x' +alias gcsam='git commit -S -am' +alias gct='git checkout --track' +alias gd='git diff' +alias gdel='git branch -D' +alias gds='git diff --staged' +alias gdt='git difftool' +alias gdv='git diff -w "$@" | vim -R -' +alias get='git' +alias gexport='git archive --format zip --output' alias gf='git fetch --all --prune' alias gft='git fetch --all --prune --tags' -alias gfv='git fetch --all --prune --verbose' alias gftv='git fetch --all --prune --tags --verbose' -alias gus='git reset HEAD' -alias gpristine='git reset --hard && git clean -dfx' -alias gclean='git clean -fd' -alias gm="git merge" -alias gmv='git mv' -alias g='git' -alias get='git' -alias gs='git status' -alias gss='git status -s' -alias gsu='git submodule update --init --recursive' +alias gfv='git fetch --all --prune --verbose' +alias gg='git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative' +alias ggf='git log --graph --date=short --pretty=format:'%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'' +alias ggs='gg --stat' +alias ggui='git gui' +alias ghm='cd '$(git rev-parse --show-toplevel)'' # Git home alias gl='git pull' -alias gpl='git pull' +alias gll='git log --graph --pretty=oneline --abbrev-commit' alias glum='git pull upstream master' -alias gpr='git pull --rebase' -alias gpp='git pull && git push' -alias gup='git fetch && git rebase' +alias gm='git merge' +alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' +alias gmv='git mv' +alias gnew='git log HEAD@{1}..HEAD@{0}' # From http://blogs.atlassian.com/2014/10/advanced-git-aliases/ # Show commits since last pull alias gp='git push' +alias gpatch='git format-patch -1' alias gpd='git push --delete' +alias gpf='git push --force' +alias gpl='git pull' alias gpo='git push origin HEAD' +alias gpom='git push origin master' +alias gpp='git pull && git push' +alias gpr='git pull --rebase' +alias gpristine='git reset --hard && git clean -dfx' +alias gprom='git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master' # Rebase with latest remote master alias gpu='git push --set-upstream' +alias gpunch='git push --force-with-lease' alias gpuo='git push --set-upstream origin' alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)' -alias gpom='git push origin master' alias gr='git remote' -alias grv='git remote -v' alias gra='git remote add' alias grb='git rebase' alias grm='git rebase master' +alias grm='git rm' alias grmi='git rebase master -i' -alias gd='git diff' -alias gds='git diff --staged' -alias gdt='git difftool' -alias gdv='git diff -w "$@" | vim -R -' -alias gc='git commit -v' -alias gca='git commit -v -a' -alias gcm='git commit -v -m' -alias gcam="git commit -v -am" -alias gci='git commit --interactive' -alias gcamd='git commit --amend' -alias gb='git branch' -alias gba='git branch -a' -# FROM https://stackoverflow.com/a/58623139/10362396 -alias gbc='git for-each-ref --format="%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)" refs/remotes/ --sort=authorname DESC' -alias gbt='git branch --track' -alias gbm='git branch -m' -alias gbd='git branch -d' -alias gbD='git branch -D' -alias gcount='git shortlog -sn' -alias gcp='git cherry-pick' -alias gcpx='git cherry-pick -x' -alias gco='git checkout' -alias gcom='git checkout master' -alias gcb='git checkout -b' -alias gcob='git checkout -b' -alias gct='git checkout --track' -alias gcpd='git checkout master; git pull; git branch -D' -alias gexport='git archive --format zip --output' -alias gdel='git branch -D' -alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' -alias gll='git log --graph --pretty=oneline --abbrev-commit' -alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative" -alias ggf="git log --graph --date=short --pretty=format:'%C(auto)%h %Cgreen%an%Creset %Cblue%cd%Creset %C(auto)%d %s'" -alias ggs="gg --stat" -alias gsh="git show" -alias gsl="git shortlog -sn" -alias gwc="git whatchanged" -alias gt="git tag" -alias gta="git tag -a" -alias gtd="git tag -d" -alias gtl="git tag -l" -alias gpatch="git format-patch -1" -# From http://blogs.atlassian.com/2014/10/advanced-git-aliases/ -# Show commits since last pull -alias gnew="git log HEAD@{1}..HEAD@{0}" -# Add uncommitted and unstaged changes to the last commit -alias gcaa="git commit -a --amend -C HEAD" -# Rebase with latest remote master -alias gprom="git fetch origin master && git rebase origin/master && git update-ref refs/heads/master origin/master" -alias gpf="git push --force" -alias gpunch="git push --force-with-lease" -alias ggui="git gui" -alias gcsam="git commit -S -am" -# Stash aliases -alias gst="git stash" -alias gstb="git stash branch" -alias gstd="git stash drop" -alias gstl="git stash list" -# Push introduced in git v2.13.2 -alias gstpu="git stash push" -alias gstpum="git stash push -m" -# Save deprecated since git v2.16.0 -# - aliases now resolve to push -alias gsts="git stash push" -alias gstsm="git stash push -m" -# Alias gstpo added for symmetry with gstpu (push) -# - gstp remains as alias for pop due to long-standing usage -alias gstpo="git stash pop" -alias gstp="git stash pop" -# Switch aliases - Requires git v2.23+ -alias gsw="git switch" -alias gswm="git switch master" -alias gswc="git switch --create" -alias gswt="git switch --track" -# Git home -alias ghm='cd "$(git rev-parse --show-toplevel)"' +alias grv='git remote -v' +alias gs='git status' +alias gsd='git svn dcommit' +alias gsh='git show' +alias gsl='git shortlog -sn' +alias gsr='git svn rebase' # Git SVN +alias gss='git status -s' +alias gst='git stash' # Stash aliases +alias gstb='git stash branch' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gstpo='git stash pop' # Alias gstpo added for symmetry with gstpu (push) # - gstp remains as alias for pop due to long-standing usage +alias gstpu='git stash push' # Push introduced in git v2.13.2 +alias gstpum='git stash push -m' +alias gsts='git stash push' # Save deprecated since git v2.16.0 # - aliases now resolve to push +alias gstsm='git stash push -m' +alias gsu='git submodule update --init --recursive' +alias gsw='git switch' # Switch aliases - Requires git v2.23+ +alias gswc='git switch --create' +alias gswm='git switch master' +alias gswt='git switch --track' +alias gt='git tag' +alias gta='git tag -a' +alias gtd='git tag -d' +alias gtl='git tag -l' +alias gu='git ls-files . --exclude-standard --others' # Show untracked files +alias gup='git fetch && git rebase' +alias gus='git reset HEAD' +alias gwc='git whatchanged' + if ! _command_exists gh; then alias gh='ghm' fi -# Show untracked files -alias gu='git ls-files . --exclude-standard --others' - -# Git SVN -alias gsr='git svn rebase' -alias gsd='git svn dcommit' case $OSTYPE in darwin*)