Skip to content

Instantly share code, notes, and snippets.

@Kova93
Last active May 16, 2023 10:32
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 Kova93/0e17b8bae31ac384ef5c89b4240cccde to your computer and use it in GitHub Desktop.
Save Kova93/0e17b8bae31ac384ef5c89b4240cccde to your computer and use it in GitHub Desktop.
git aliases
[core]
longpaths = true
[alias]
printbranch = branch --show-current
nuke = !"git reset --hard; git clean -fdx #"
get = !"git fetch origin $1:$1 #"
go = !"if [ \"$(git printbranch)\" != \"$1\" ]; then git get $1; git checkout $1; fi #"
fp = fetch --prune
pullall = !"git pull; git branch -v | grep -Po '(?<=^ )(\\S+)(?=\\s+\\S+\\s+\\[behind \\d+\\])' | xargs -r -L 1 git get #"
cleanupbranches = !"git branch -vv | grep ': gone' | awk '{print $1}' | xargs -r -L 1 git branch -D #"
cub = cleanupbranches
pushnew = !"git push --set-upstream origin $(git printbranch) #"
pn = pushnew
resolve = !"vim $(git status --porcelain | grep -Po '(?<=^UU ).*') #"
smu = submodule update --init --recursive
[push]
default = simple
[log]
decorate = auto
[pull]
ff = only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment