Skip to content

Commit

Permalink
git everybody-out
Browse files Browse the repository at this point in the history
  • Loading branch information
nonrational committed Nov 1, 2024
1 parent 4a6dce8 commit 564e796
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

broom = "!. ~/.githelpers && delete_remoteless_branches_interactive"
spring-cleaning = "!. ~/.githelpers && delete_all_my_branches_interactive"
everybody-out = "!. ~/.githelpers && delete_all_others_local_branches"

nuke = "!git reset --hard HEAD && git clean -fd"

Expand Down
9 changes: 9 additions & 0 deletions .githelpers
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ delete_all_my_branches_interactive(){
done
}

# Delete all non-personally-prefixed non-primary branches.
delete_all_others_local_branches(){
for branch in $(git branch | grep '/' | grep -v 'aln\|anorton\/'); do
printf "Delete $branch? ";
read ans;
[[ "$ans" == "y" ]] && git branch -D $branch
done
}

# Accepts a sed substituion (e.g., s/foo/bar/) and applies it to the current branch, also unsetting the upstream branch.
rename_branch_regex(){
if [ -z "$1" ]; then
Expand Down

0 comments on commit 564e796

Please sign in to comment.