sh/bash/alias/git.sh
2023-05-14 17:56:00 +02:00

208 lines
4.2 KiB
Bash

# add to index
alias ga="\
git \
add \
"
# add all to index
alias gaa="\
git \
add \
--all \
"
# create a branch
alias gb='git branch'
# delete a branch
alias gbd='git branch --delete'
# force a branch deletion
alias gbdf='git branch --delete --force'
# list branches
alias gbl='git branch --all --list --verbose --verbose'
# set the link to a remote branch from a local branch
alias gbu='git branch -u'
# clone a remote repository
alias gc='git clone'
# clean untracked files
alias gcf='git clean -d --force'
# index all and commit
alias gacm='git add --all;git commit -m'
# commit the index
alias gcm='git commit -m'
# redo the last commit with a different message
alias gcma='git commit --amend -m'
# make a root commit
alias gcmr='git commit --allow-empty --allow-empty-message -m ""'
# commit the index and sign
alias gcms='git commit --gpg-sign -m'
# switch to a branch or checkout file(s) from a commit
alias gco='git checkout'
# checkout an orphan branch
alias gcoo='git checkout --orphan'
# checkout development branch
alias gcod='git checkout dev'
# checkout feature branch
alias gcof='git checkout f'
# pick a commit
alias gcp='git cherry-pick'
# abort the commit pick
alias gcpa='git cherry-pick --abort'
# continue the commit pick
alias gcpc='git cherry-pick --continue'
# configure the user name
alias gcun='git config user.name'
# configure the user email
alias gcue='git config user.email'
# differences from last or between commits
alias gd='git diff'
# display what is indexed in cache
alias gdc='git diff --cached'
# indexed character-level differences
alias gdcw='git diff --cached --word-diff-regex=.'
# differences via external tool
alias gdt='git difftool --dir-diff'
# character-level differences
alias gdw='git diff --word-diff-regex=.'
# fetch from the remote repository
alias gf='git fetch --tags --verbose'
# fetch from remote repository and prune local orphan branches
alias gfp='git fetch --prune --tags --verbose'
# garbage collect all orphan commits
alias ggc="\
git \
reflog \
expire \
--all \
--expire \"all\" \
; \
git \
gc \
--aggressive \
--prune=\"now\" \
"
# initialize a new repository
alias gi='git init'
# initialize a new bare repository
alias gib='git init --bare'
# log commits history
alias gl='git log --all --graph \
--format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B"'
# log commits history with patches
alias glp='git log --all --graph \
--format="%C(auto)%h%d %C(red)%ai%C(auto) %an%n%B" --patch'
# log medium information
alias glm='git log --all --decorate --graph --pretty=medium'
# fast-forward to remote branch
alias gmf='git merge --ff-only'
# do a merge commit
alias gmc='git merge --no-ff -m'
# abort the current merge commit
alias gma='git merge --abort'
# squash a branch and index its modifications
alias gms='git merge --squash'
# merge via external tool
alias gmt='git mergetool'
# push to the remote repository
alias gp='git push --tags --verbose'
# delete from the remote repository
alias gpd='git push --delete --verbose'
# force the push to the remote repository
alias gpf='git push --tags --verbose --force'
# rebase current branch onto another
alias grb='git rebase'
# abort current rebase
alias grba='git rebase --abort'
# continue current rebase
alias grbc='git rebase --continue'
# force rebase without fast-forward
alias grbf='git rebase --no-ff'
# rebase interactively
alias grbi='git rebase --interactive'
# list all remote repositories
alias grm='git remote'
# add a new remote repository
alias grma='git remote add'
# list remote repositories
alias grml='git remote --verbose'
# show a connection to a repository
alias grms='git remote show'
# set the location of the remote repository
alias grmu='git remote set-url'
# remove file(s) from index or move current branch pointer
alias grs='git reset'
# move current branch pointer to the development branch
alias grsd='git reset dev'
# wipe modifications or reset current branch to another commit
alias grsh='git reset --hard'
# reset current branch to the development branch
alias grshd='git reset --hard dev'
# current state of repository
alias gs='git status --untracked-files=all'
# show a commit
alias gsh='git show'
# tag a commit
alias gt='git tag'
# delete a tag
alias gtd='git tag --delete'
# tag a commit and sign
alias gts='git tag --sign'