0

if I have many remote branches merge into branch DEV, how do I list all remote branches merged into DEV and how to delete these remote branches.

git branch -r --merged <commit>

this command shows all remote branches are reachable from the specified commit.

but i don't know how to delete it. Please guide.

gnujoow
  • 359
  • 1
  • 3
  • 15
  • 2
    Possible duplicate of [How can I delete all Git branches which have been merged?](https://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged) – Venkataraman R Sep 18 '18 at 05:09
  • @Cœur actually merged is right. thanks for your correction anyway :+1: – gnujoow Sep 18 '18 at 05:13

2 Answers2

0

you can use git branch -d branchname if the branch is merged.

if the branch is not merged, you can use git branch -D branchname to delete the specific branch.

Dheeraj Kumar
  • 329
  • 1
  • 12
0

to delete all remote braches that merge is

git branch -r --merged | grep -v master | sed 's/origin\//:/' | xargs -n 1 git push origin
gnujoow
  • 359
  • 1
  • 3
  • 15