gitmergegit-flowfeature-branch

Is it safe to delete or remerge a Gitflow feature branch after it was previously merged into the develop branch?


Let's take the Gitflow branching style. For every feature we have a "feature branch". We develop the feature, and once it's done, we can merge it into the "develop" branch.

  1. Once the merge is done, can we simply delete the branch and nothing will ever be lost in the commit log history?

  2. Assuming we haven't deleted the feature branch. After the merge into "develop", someone reviews the change and spots some minor issue (e.g. a misspelling or some other minor change). Is it safe to do the change in the "feature branch" and re-merge it into the "develo" branch? Or is it more appropriate to always create a new "feature branch" even for trivial things that mostly affect the work been done in some previous "feature"?


Solution

  • Once the merge is done, can we simply delete the branch and nothing will ever be lost in the commit log history?

    You would loose the intermediate commits done on the feature branch (if the merge wasn't a fast-forward one), but that is normally ok if the feature isn't too big (only the resulting merge commit matters).

    Assuming we haven't deleted the feature branch. After the merge into "develop", someone reviews the change and spots some minor issue (e.g. a misspelling or some other minor change).
    Is it safe to do the change in the "feature branch" and re-merge it into the "develo" branch? Or is it more appropriate to always create a new "feature branch" even for trivial things that mostly affect the work been done in some previous "feature"?

    Yes, you can re-use your feature branch since the next merge will only involve the new commit(s), not the older ones (which are marked as already merged).