Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Workflows Git-Flow

amourief
amourief
5,469 Points

Just curious as to why the hotfix branch is deleted locally after it's merged back onto the master?

Considering there could be a reason why you'd like to revert edit the hotfix branch again, I would think it would be best if it wasn't automatically deleted after being merged back into the master.

2 Answers

I think the idea is that the branch is used for one change and then merged when the change is completed. It's not very hard to recreate the branch if you want to use it again, but later(?) you'll see they start naming branches after the feature or fix that they are working on and so the delete branch after merge starts to make sense. You can always recreate a branch of the same name to keep working if you want to.

amourief
amourief
5,469 Points

Thank you for the answer Karen. I too was thinking along the same lines as you.

amourief
amourief
5,469 Points

Thank you for the answer Karen. I too was thinking along the same lines as you.

Just as a side note, if you merge one branch to another (say a new_feature branch to development branch) and then delete the feature branch, the history of new_feature branch will still be preserved so you can go back to it at anytime.

If you delete a branch when its not merged into another branch then its commits will be deleted and will be unreachable(there are ways to recover them but that goes beyond this).

Also, Git Flow uses git merge --no-ff new_feature making sure that the history of the merged branch is always preserved.