Skip to content

Instantly share code, notes, and snippets.

@salarmehr
Last active July 25, 2021 17:25
Show Gist options
  • Save salarmehr/db3de3a64573a5fb79e708a6c3d1a69e to your computer and use it in GitHub Desktop.
Save salarmehr/db3de3a64573a5fb79e708a6c3d1a69e to your computer and use it in GitHub Desktop.
Git aliases that you cannot live without them
[core]
autocrlf = false
[push]
default = current
# push tags missing from remote
# See https://git-scm.com/docs/git-push#git-push---follow-tags
followTags = true
[pull]
default = current
[rebase]
autosquash = true
[alias]
track = git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`
ll = log --oneline
sweep = !git branch --merged $([[ $1 != \"-f\" ]] \\\n&& git rev-parse master) | egrep -v \"(^\\*|^\\s*(master|develop)$)\" \\\n| xargs git branch -d
sweep-origin = !git branch --all --merged remotes/origin/master | grep --invert-match master | grep --invert-match HEAD | grep \"remotes/origin/\" | cut -d \"/\" -f 3- | xargs -n 1 git push --delete origin
# Links
# https://github.com/ironcodestudio/ironcode-git-enhancements
# sweep: https://stackoverflow.com/a/51436631/752603 delete branches that have been merged into master, but the -f flag will delete branches that have been merged into the current branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment