0

We are using a branch named 'integration' as our master branch (we still have a master, but we're not using it for now) and we have a bunch of branches that have been created off it then merged back in and need to be deleted. I found this question about deleting local branches, but wasn't sure about applying the suggestions to my particular situation.

I think this will work, don't want to run this command and have it be wrong and screw up the repo.

$ git checkout integration

$ git branch -r --merged | grep -v integration| sed 's/origin//:/' | xargs -n 1 git push origin

Community
  • 1
  • 1
CF_HoneyBadger
  • 2,960
  • 2
  • 14
  • 16

1 Answers1

1

You need to escape that /, make it ...sed 's/origin\//:/'... but otherwise, sure, that would work.

To test stuff like this, just leave the xargs part off so you see what will happen.

AnoE
  • 8,048
  • 1
  • 21
  • 36
  • That did it, thanks! Also, I was hoping for a way to 'test' the command before running it, so double kudos for adding the xargs part. – CF_HoneyBadger Aug 05 '16 at 12:27