Skip to content

Instantly share code, notes, and snippets.

@orgmir
Created November 17, 2025 00:53
Show Gist options
  • Select an option

  • Save orgmir/7113288e84893ece2fbf7bd9cd760f02 to your computer and use it in GitHub Desktop.

Select an option

Save orgmir/7113288e84893ece2fbf7bd9cd760f02 to your computer and use it in GitHub Desktop.
Git aliases
alias.force-push=push --force-with-lease
alias.local-prune=!git fetch --prune && git prune origin
alias.branch-delete-remote=!git branch -r --merged origin/main | grep -v 'origin/main$' | xargs git branch -d
alias.branch-delete-local=!git branch --merged origin/main | grep -v 'main$' | xargs git branch -d
alias.sync=!git checkout main && git pull && git local-prune && git branch-delete-remote && git branch-delete-local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment