Feature branches in remote not getting deleted

I'm having an issue with using git-flow. Not sure if this is the expected behavior so please clarify it for me.

I create an empty repo in Bitbucket and clone it to my local machine. Then I create an Xcode project (I do iOS developing) inside that repo, commit it and push it to Bitbucket.

Then I went ahead and initialzed my local repo to use git flow. I use SourceTree by the way. Then I created a new feature branch, let's call it FirstFeature. I add some files to the project and push it again. Now I have 3 branches in my remote repo; master, develop and FirstFeature.

Then I work on the project again and finish off that feature. The FirstFeature branch gets deleted and merged it with develop locally. Then I proceed to push it to Bitbucket. I thought since the local branch of FirstFeature got deleted, it would get removed when I push the new changes but apparently not. That FirstFeature branch is still there in my Bitbucket repo.

Is this expected behavior or do I need to do something extra to get these removed?

Thank you.

1 answer

1 accepted

Hi Isuru,

By default git flow only deletes the local branch for you. You can delete remote branches manually using the syntax:

git push origin :branchname

This StackOverflow thread has a couple of other suggestions that may help.

Hope this helps! 

cheers,

Tim

Hi Tim, got it. Thank you.

I found a cool fork called git-flow-avh(https://github.com/petervanderdoes/gitflow) of git-flow that does this remote deletion automatically. I'm gonna use it alongside sourcetree. I also voted up for feature request(https://jira.atlassian.com/browse/SRCTREE-1762) for sourcetree to integrate this fork instead of the original.

In the meantime, you can also delete the remote branch by finding it in the expandable "Remotes" branch list, right-clicking, then "Delete...".

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

231 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot