Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

version control - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

"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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...