Git flow: How to reopen a finished feature branch
I started using git flow a few weeks ago after reading this article: A successful git branching model. Git flow isn't absolutely necessary to work with git, but it does a good job at organizing the work on branches.
Something I couldn't understand, reading the documentation is: When a feature branch is finished, the branch is merged into the develop branch. Then the feature branch is deleted. What if I want want to re-open the feature branch later?
The key thing here is to publish the feature branches on the remote repository:
$ git flow feature publish my_feature
Before finishing the branch, make sure that the remote repository has the latest commits:
$ git push
If your git config push.default
setting is not simple
, use the following instead (assuming origin
is name of your remote repository):
$ git push origin my_feature
Then, finish your branch:
$ git flow feature finish my_feature
At this point, if there was no conflict, the my_feature
branch has been deleted from you local repository, and you're now on the develop
branch.
If you wish to continue your work on the my_feature
branch, you can still have it back by tracking the branch from the remote repository (like other developers would do to have your feature branch in their local repository):
$ git flow feature track my_feature
This will allow you to finish and re-open feature branches, as long as you don't delete them from the remote repository.