Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove branch from a remote (on Atlassian Stash/Bitbucket)

I want to delete a branch from Atlassian Stash (a sort of github clone) in order to revert my changes. Please let me know what command will do this?

What I know is git branch –D prod-652 deletes the branch from local. How can I delete it from Atlassian Stash?

like image 287
Praveen Avatar asked Oct 14 '13 10:10

Praveen


People also ask

How do I delete a branch from a remote branch?

To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .

Is it okay to delete a branch in your remote repository?

It is safe to delete your local branch after you pushed your changes to your own remote repository. The pull request is unrelated to this, because it is simply a request to the maintainers of the original repository to merge your changes back into their code base.


2 Answers

Here are the commands:

git branch –D branch-name (delete from local) git push origin :branch-name (delete from stash) 

Note the colon (:) in the last command.

like image 189
Praveen Avatar answered Sep 22 '22 12:09

Praveen


In Stash (2.10), go to the Branches view. You can select Delete from the Actions button

like image 31
wreckgar23 Avatar answered Sep 21 '22 12:09

wreckgar23