Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertoestivill/462d149d9f1d442be4cdcf688d5a6bad to your computer and use it in GitHub Desktop.
Save robertoestivill/462d149d9f1d442be4cdcf688d5a6bad to your computer and use it in GitHub Desktop.
Git alias
alias git-master='git checkout master'
alias git-add-commit='function _git-add-commit(){ git add -A "$1"; git commit -S -m "$2"; }; _git-add-commit'
alias git-undo='git reset HEAD~'
alias git-checkout-branch='git checkout'
alias git-checkout-tag='function _git-checkout-tag(){ git checkout tags/"$1"; }; _git-checkout-tag'
# Branch is created on both, local and remote
alias git-new-branch='function _git-new-branch(){ git checkout -b "$1"; git push -u origin "$1"; }; _git-new-branch'
alias git-new-tag='function _git-new-tag(){ git tag -a "$1" -m "$1"; }; _git-new-tag'
# Deletions are both local and remote
alias git-del-branch='function _git-del-branch(){ git checkout master; git branch -D "$1"; git push origin :"$1"; }; _git-del-branch'
alias git-del-tag='function _git-del-tag(){ git tag -d "$1"; git push origin :refs/tags/"$1"; }; _git-del-tag'
alias git-log='git log --graph --abbrev-commit --decorate --date=relative --format=format:'\''%C(bold blue)%h%C(reset) %C(dim white)%an%C(reset) %C(bold green)(%ai)%C(reset) %C(white)%s%C(reset) %C(bold yellow)%d%C(reset)'\'' --all'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment