Skip to content

Instantly share code, notes, and snippets.

@johnazariah
Last active August 27, 2020 12:58
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 johnazariah/8ef121ab098073b48e10 to your computer and use it in GitHub Desktop.
Save johnazariah/8ef121ab098073b48e10 to your computer and use it in GitHub Desktop.
Git Aliases
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
[alias]
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lg = lga -20
ca = commit -a
ci = commit
st = status
co = checkout
br = branch
fop = fetch origin --prune
cob = checkout -b
rom = rebase origin/main
new = !git init && git symbolic-ref HEAD refs/heads/main
alias = ! git config --get-regexp ^alias\. | sed -e s/^alias\.// -e s/\ /\ =\ /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment