0

I have a bunch of remote branches on my git server that all start w/ the same prefix

  origin/feature/100-use-email-to-get-all-sockets
  origin/feature/101-remove-buttons-on-response
  origin/feature/102-delete-removes-from-store
  origin/feature/103-erik-fix-moderator-logged-multiple-times-when-logged-in-as-admin-and-client
  origin/feature/31-client-accordian-list-on-admin-side
  origin/feature/33-video-skin-ios
  ...

quite frequently I need to clean up the server and purge all the old-outdated branches

I'm trying to write a script, but I want the ability to pass in a variable that I want to target instead of hard coding like "feature", "bug", etc...

How can I incorporate this variable into this command? all the examples I've found seem to fail.

TGT=feature
git branch -r | awk -F/ '/\/feature/{print $3}'

What I'm looking for is something like

TGT=feature
git branch -r | awk -F/ '/\/$TGT/{print $3}'
veilig
  • 5,085
  • 10
  • 48
  • 86

0 Answers0