Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finishing a feature branch with GIT Flow

From my understanding one of the advantages of creating feature branches is so that you can easily see where large groups of commits have been merged into the develop branch.

Upon finishing a feature branch the recommendation is to delete the feature branch since it is no longer needed for development. Once the branch has been deleted, will the graph still be annotated with "feature/my-fancy-feature" branched and merged?

like image 484
Lea Hayes Avatar asked May 06 '13 17:05

Lea Hayes


People also ask

How do you finish a feature branch?

From my understanding one of the advantages of creating feature branches is so that you can easily see where large groups of commits have been merged into the develop branch. Upon finishing a feature branch the recommendation is to delete the feature branch since it is no longer needed for development.

What does git flow finish do?

So in our case, when we "finish" a git flow branch, it makes sense to immediately push the branches + tags to the remote instead of having to enter the git flow commands directly. After entering this config, git flow will automatically push the branches on the remote, thus saving extra time and avoiding confusion.

How do I complete a git release branch?

Use the “git flow release start” command to create the release branch. When the release is stable, run the “git flow release finish” command. $ git flow release finish '0.1.

Can you branch off a feature branch in git?

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.


2 Answers

"Upon finishing a feature branch the recommendation is to delete the feature branch since it is no longer needed for development."

Difference between "discarding" and "merging" the feature branch:

"Finishing" is an ambiguous expression here. To make sure I fully cover your question, I believe you meant either one of the following cases:

(1) If you wish to discard the feature/my-fancy-feature:

git branch -d feature/my-fancy-feature

(2) If you meant to merge the feature/my-fancy-feature:

git flow feature finish my-fancy-feature

"Once the branch has been deleted, will the graph still be annotated with "feature/my-fancy-feature" branched and merged?"

Difference between "fast-forward-merge" and "non-fast-forward-merge"

It depends (the outcome is not git-flow dependent). git log won't give you the specific branch name (e.g. feature/my-fancy-feature). It will only give you the commit history with the message. Recalling the differences between fast-forward merging and non-fast-forward merging:

fast-forward-merge (all commit history made in feature/my-fancy-feature will remain):

git merge

non-fast-forward-merge (all commit history made in feature/my-fancy-feature will be gone):

git merge --no-ff

Refere to the following illustration from Vincent Driessen's article:

enter image description here

Update

To enable non-fast-forward feature in SourceTree, check the below global preference option found from Menubar-> SourceTree -> Preferences -> Git:

enter image description here

For further explanation, I found this excerpt from SourceTree's "Help Center":

disables fast-forward behaviour when merging, meaning that an explicit merge commit is always created regardless of whether there are other changes in the receiving branch. This can be useful if you want to maintain an explicitly separate line of development in all cases.

Hope it helped!

like image 132
melvynkim Avatar answered Oct 17 '22 00:10

melvynkim


No, only the commit messages will remain; if you want to retain the name of the branch, be sure to include it in the merge commit or explicitly tag the merge commit with a related name.

Your best bet is to stop worrying about retaining this data outside of the commit messages; by the time you merge your feature branch, you shouldn't care that the work was done on a feature branch.

like image 38
meagar Avatar answered Oct 16 '22 22:10

meagar