How to delete a local and remote Git branch?

19

I want to delete a local branch and in my remote project in GitHub.

    
asked by anonymous 05.05.2015 / 17:46

4 answers

31

To delete the branch locally:

git branch -D <nome do branch>

To delete the branch remotely:

git push <nome do origin> <nome do branch> --delete
    
05.05.2015 / 17:54
0

To remove local branch:

 git branch -d nome-do-branch

And to remove remote branch add the "-r" flag:

 git branch -dr origin/nome-do-branch
    
30.10.2015 / 19:11
-2
  

git push origin: bin_name

Juarez Lustosa's response for some reason has been denied and he still has a comment saying that "he wants to delete a branch, not to upload his commits."

But it is a valid answer, used to exclude remote branchs, and simpler than the others cited. If you have not noticed before nome_do_branch has two points ( : ) and this is what deletes the branch and does not push.

    
16.04.2018 / 20:32
-3

git push origin: bin_name

    
27.10.2016 / 15:47