Delete the branch from local and Remote origin in GIT

Delete the branch from local and Remote origin in GIT:

1. We can also delete the branch from locally and Remote origin in GIT.

2. Locally if you want to delete use below command

git branch -d <BRANCHNAME> 

OR

git branch -D <BRANCHNAME> 

OR

git branch –delete <BRANCENAME>

Here -d or -D both are alias for the delete.

-d :  Delete the branch which already been fully merged in its upstream branch.

-D : force delete, deletes the branch irrespective of its merged
3. Delete the branch from Remote location

git push origin --delete test

OR

git push origin --delete origin/test 

OR

git push origin :serverfix

Be Patient, Drive With Care

Leave a Reply