我的git服务器上有一堆远程分支,它们都以相同的前缀
开头 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
...
我经常需要清理服务器并清除所有旧的过时的分支
我正在尝试编写一个脚本,但是我希望能够传入一个我想要定位的变量,而不是硬编码,例如" feature"," bug&#34 ;等等......
如何将此变量合并到此命令中?我发现的所有例子似乎都失败了。
TGT=feature
git branch -r | awk -F/ '/\/feature/{print $3}'
我正在寻找的是
TGT=feature
git branch -r | awk -F/ '/\/$TGT/{print $3}'