Last active
February 20, 2026 15:33
-
-
Save larouxn/b3e4b9387d0f47495aa970b831901149 to your computer and use it in GitHub Desktop.
🔥 atokatadzuke ✨
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # _ _ _ _ _ | |
| # | | | | | | | | | | | |
| # __ _| |_ ___ | | ____ _| |_ __ _ __| |_____ _| | _____ | |
| # / _` | __/ _ \| |/ / _` | __/ _` |/ _` |_ / | | | |/ / _ \ | |
| # | (_| | || (_) | < (_| | || (_| | (_| |/ /| |_| | < __/ | |
| # \__,_|\__\___/|_|\_\__,_|\__\__,_|\__,_/___|\__,_|_|\_\___| | |
| # | |
| # | |
| # ascii art thanks tro https://calligraphy.geopjr.dev/ | |
| # 後片付け | https://jisho.org/word/%E5%BE%8C%E7%89%87%E4%BB%98%E3%81%91 | |
| # | |
| # Cleanup your non-primary branches in one quick command. Note, does not preserve unmerged branches. | |
| # Use: atokatadzuke | |
| # | |
| # Helper function to dynamically detect the primary branch | |
| _git_default_branch() { | |
| # Check if 'main' exists locally or on the remote | |
| if git rev-parse --verify --quiet refs/heads/main >/dev/null || \ | |
| git rev-parse --verify --quiet refs/remotes/origin/main >/dev/null; then | |
| echo "main" | |
| else | |
| echo "master" | |
| fi | |
| } | |
| # Delete all local branches except the primary branch | |
| remall() { | |
| local primary=$(_git_default_branch) | |
| git branch | grep -E -v "^\*|^\s*$primary$" | xargs -r git branch -D | |
| } | |
| # Checkout the primary branch, clean up, and clear | |
| atokatadzuke() { | |
| local primary=$(_git_default_branch) | |
| git checkout "$primary" && remall && clear | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment