Last active
November 7, 2022 05:25
-
-
Save azrsh/46267d1a8e245d9001d6f79a30797c5d to your computer and use it in GitHub Desktop.
origin の デフォルトブランチを取得する / マージ済みブランチを削除する
This file contains 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
#!/bin/bash | |
set -euCo pipefail | |
function main() { | |
local default_branch="$(git default-branch)" | |
git branch -d $(git branch --merged "${default_branch}" | grep -vE "\*|${default_branch}") | |
} | |
main |
This file contains 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
#!/bin/bash | |
set -euCo pipefail | |
git remote show origin | grep -E '^\s*HEAD branch: \w+$' | awk '{print $NF}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment