Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete a 'feature' branch using gitflow without merging into master branch

I am using the Git GUI called 'Souretree' by Atlassian and in particular the 'Gitflow' module to manage various branches.

I just created a 'release' branch that I don't want to merge back into either the master or develop branches. How do I get rid of it ? Can I just delete it ? My concern is that I mess up the gitflow config.

I have only made one commit to this branch which i don't care about.

like image 366
johowie Avatar asked Mar 03 '14 01:03

johowie


People also ask

How do I delete a branch without merging?

Delete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet. The branch is now deleted locally.

How do I delete a git feature branch?

The command to delete a local git branch can take one of two forms: git branch –delete old-branch. git branch -d old-branch.

Can you branch off a feature branch?

No, but you won't be able to merge your work into develop without merging also the commits from the feature branch. If feature branch is merged when you finally merge your own work to develop , all the common commits won't be merged twice.

Can I delete feature branch after merge?

When you're done with a branch and it has been merged into master, delete it. A new branch can be made off of the most recent commit on the master branch. Also, while it is ok to hang onto branches after you've merged them into the master they will begin to pile up.


1 Answers

It seems that I can just delete the branch according to the following sources: Evan Hahn dominiksymonowicz

To quote Evan:

To trash a branch using git-flow , simply delete it like you'd normally delete a Git branch:

git branch -D whatever/branch/you/wanna/delete

Note that this does a forced delete, so anything you did on that branch will be lost. You can be safer with the lowercase -d flag instead.

So using the sourcetree GUI interface i first changed to another branch ( in my case develop) and then simply right clicked on the release branch name in the list of branches in the left hand panel and selected Delete release/releaseName. This gave me the option to do so with as a Force Delete, which in my case was necessary as I wanted to delete the unmerged commits as well.

like image 119
johowie Avatar answered Sep 28 '22 12:09

johowie