Cool git aliases that I find useful in daily life
GitHub Repo : https://github.com/Magnus167/git-aliases
[alias]
pmerge = "!f() { BRANCH=$(git branch --show-current); git checkout $1 && git pull && git checkout $BRANCH && git merge $1; }; f"
staash = stash --all
branchc = branch --show-current
clonegh = "!f() { git clone https://github.com/$1.git; }; f"
co = checkout
cop = "!f() { git checkout $1 && git pull; }; f"
cob = checkout -b
branchr = branch --sort=-committerdate
logp = log --pretty=format:\"%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) [%an]\" --abbrev-commit -30
logl = log --oneline
graph = log --oneline --graph --decorate
prunegone = !git fetch --prune && git branch -vv | awk '/: gone]/{print $1}' | xargs -r git branch -d
fame = !python -m gitfame
github = "!f() { URL=$(git remote get-url origin); python -m webbrowser -t $URL; }; f"
pr = "!f() { BRANCH=$(git branch --show-current); REPOURL=$(git config --get remote.origin.url); python ~/git-aliases/python/getpr.py $REPOURL $BRANCH; }; f"
co-pr = "!f() { REPOURL=$(git config --get remote.origin.url); BRANCH=$(python ~/git-aliases/python/checkoutpr.py $REPOURL $1); git checkout $BRANCH; git pull; }; f"
See this script for the pr
/getpr.py
workflow: get_pr_full.py