Skip to content

Instantly share code, notes, and snippets.

@welldan97
Last active January 2, 2016 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save welldan97/8281161 to your computer and use it in GitHub Desktop.
Save welldan97/8281161 to your computer and use it in GitHub Desktop.
Clean up git repo
#!/bin/bash
main(){
reset_branch
remove_all_branches_besides_current
remove_all_stashes
remove_all_uncheked_files
}
reset_branch(){
git reset --hard
}
remove_all_branches_besides_current(){
git branch -D $(git branch | grep -v \* | xargs)
}
remove_all_stashes(){
git stash clear
}
remove_all_uncheked_files(){
git clean -d -f
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment