Last active
November 26, 2024 22:47
-
-
Save PharaohKJ/b2e6d7de3ff8191050d5ac2ee1905631 to your computer and use it in GitHub Desktop.
remove merged branch
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
`git branch --merged`.split(/\R/).map(&:strip).reject { |r| r[0] == '*' || r == 'master' || r == 'main' }.each { |r| system "git branch --delete #{r}" } | |
`git branch --all --merged remotes/origin/main`.split(/\R/).map(&:strip).reject { |r| r[0] == '*' || r == 'master' || r == 'main' }.each { |r| system "git push --delete origin #{r.gsub('remotes/origin/', '')}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment