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 trialKareem Jeiroudi
14,984 PointsWould deleting one branch delete the rest of sub-branches made after this branch?
Let's assume we created a branch named foo_feature
, and then, and while I'm on this branch, I created another branch git branch bar_feature
. In this case, would deleting the foo_feature
branch delete bar_feature
too?
2 Answers
Mikkel Rasmussen
31,772 PointsYou will still be able to use your bar_feature branch :)
Please take look at this question on stack overflow as this sounds a lot like your question: https://stackoverflow.com/questions/2613903/does-deleting-a-branch-in-git-remove-it-from-the-history
Mikkel Rasmussen
31,772 PointsIt would not delete the bar_feature branch.
From the article: If the branch was merged into another branch before it was deleted then all of the commits will still be reachable from the other branch when the first branch is deleted. They remain exactly as they were.
Mikkel Rasmussen
31,772 PointsPlease take a look at this article instead :) https://stackoverflow.com/questions/29932046/what-happens-if-i-git-delete-a-remote-branch-that-has-subbranch-that-has-not-bee
Kareem Jeiroudi
14,984 PointsKareem Jeiroudi
14,984 PointsThanks a lot for this helpful post. However, my question is not whether or not commits that were merged are attainable:
But you can more or less imagine it this way:
In this case, would deleting
foo_feature
delete thebar_feature
branch too, because by the commit P both branchesfoo_feature
andbar_feature
shared the same log, if I'm not mistaken.