Skip to content

Instantly share code, notes, and snippets.

@antonkomarev
Last active September 13, 2021 21:09
Show Gist options
  • Save antonkomarev/7195a4b0cd63cf4e2515256050c7e895 to your computer and use it in GitHub Desktop.
Save antonkomarev/7195a4b0cd63cf4e2515256050c7e895 to your computer and use it in GitHub Desktop.
Useful git aliases to speed up development
[alias]
cleanup = "!git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D"
go = "!git switch ${1:-master} && git pull && git cleanup"

Add 2 aliases to ~/.gitconfig file.

Git cleanup

  1. deletes all local branches which were deleted remotely.
git cleanup

Git go

  1. switches to seleted branch (master by default)
  2. pulling changes from remote server
  3. deletes all local branches which were deleted remotely
git go

Same command, but with another branch name to switch to.

git go feature/custom-branch-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment