Skip to content

Instantly share code, notes, and snippets.

@danielhopkins
Created March 14, 2013 16:22
Show Gist options
  • Save danielhopkins/5162770 to your computer and use it in GitHub Desktop.
Save danielhopkins/5162770 to your computer and use it in GitHub Desktop.
git push mirror
# from .git_functions
function git_helpers_clean_remote() {
remote=$1
git ls-remote -h $remote |
git show-ref --heads --exclude-existing |
cut -f 2 | xargs git push --delete $remote
}
# from .gitconfig
[alias]
pm = !git push -f --all $1 && git clean-remote $1
# So the idea here is that on *my forks* I keep them looking exactly like
# my working directory. Github is almost a form of backup / publically viewable code repo at this point.
# The nice thing is that when I delete a branch, it gets cleaned up from the remote and
# I also push to the remote extremely frequently (really could be a post_commit hook)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment