Skip to content

Instantly share code, notes, and snippets.

@Ikloo
Last active March 2, 2018 20:40
Show Gist options
  • Save Ikloo/bacd2f967f8cb5f748219ad21e18b224 to your computer and use it in GitHub Desktop.
Save Ikloo/bacd2f967f8cb5f748219ad21e18b224 to your computer and use it in GitHub Desktop.
Delete merged branches remote. Use with git alias. Add this snippet into .gitconfig

git-cleanup-remote

Info

Delete merged branches remote. Use with git alias.


Install

[alias]
	cleanup-remote = "!git branch -r --merged | grep -v '\\*\\|master\\|develop\\|`THE_NAME_OF_THE_BRANCH`' | sed 's/origin\\///' | xargs -n 1 git push --delete origin"

Add this snippet into .gitconfig


Usage

Run git cleanup-remote


Kirill Budevich

github.com/theikloo

@theikloo


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment