Skip to content

Instantly share code, notes, and snippets.

@PharaohKJ
Last active July 13, 2023 20:57
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 PharaohKJ/b2e6d7de3ff8191050d5ac2ee1905631 to your computer and use it in GitHub Desktop.
Save PharaohKJ/b2e6d7de3ff8191050d5ac2ee1905631 to your computer and use it in GitHub Desktop.
remove merged branch
`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/ori
gin/', '')}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment