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 GitHub Basics Working By Yourself Conflict Resolution

Should branch names always be unique?

At the end of the video, we deleted the branch we'd made a few videos back. So from what I understand, the workflow is to create a branch whenever you want to work on your code, then delete it after it's successfully merged. Can we name our branches the same names we've used in the past or do they always need to be unique?

For example, if I'm working on a website and I see there are typos I'd like to fix, I would open a branch called 'fix-typos'; I'd fix the typos; then I'd delete the branch after I merged it. If at a later date, I find more typos I need to fix, would I open another branch called 'fix-typos' or would I have to create a new branch called 'fix-typos-2'?

I've tried googling for best practices but I don't think I know enough yet to understand what I've found and I'd really like to start off on the right foot.

Thanks!!

1 Answer

Steven Parker
Steven Parker
231,275 Points

Branches at the same nesting level that exist simultaneously should have different names. But if you delete a branch, then one created by the same name later would still be considered "unique".