admin管理员组

文章数量:1289509

Is it possible to do git push --delete a branch using a refname like refs/remotes/origin/feature_bananas?

The usual way I remove branches remotely is using git push --delete origin feature_bananas but in this case I'm getting the refname from git branch -r --list so it would be easier if I could use refs/remotes/origin/feature_bananas directly somehow.

Is it possible to do git push --delete a branch using a refname like refs/remotes/origin/feature_bananas?

The usual way I remove branches remotely is using git push --delete origin feature_bananas but in this case I'm getting the refname from git branch -r --list so it would be easier if I could use refs/remotes/origin/feature_bananas directly somehow.

Share Improve this question asked Feb 20 at 22:01 MobergMoberg 5,4694 gold badges40 silver badges62 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You could do something like this beast:

git branch --list -v --remote --format="%(refname) %(author) %(committerdate)" \
  | fzf -f"'Moberg bananas$" \
  | cut -d\  -f 1 \
  | awk -F/ '{print $3 " " $4 "/" $5 }' \
  | xargs -L1 git push --delete

本文标签: git remove (push delete) a branch in remote using a refnameStack Overflow