Skip to content

Instantly share code, notes, and snippets.

@antonkomarev
Last active September 13, 2021 21:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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