DEV Community

loading...

Discussion on: How to organize your git branches

Collapse
cseeman profile image
christine

I do a lot of ticket based naming but also like to tack on a little blurb about the ticket name so I can look at the branch and know right away which ticket. So something like "T-123/add-new-button". Then when you are in your git bash, and run git branch you can figure out your branches a bit better. I do need to get better at remembering to delete stale local and remote branches.

Collapse
sublimegeek profile image
Jonathan Irvin

I do the same. Usually, in a professional setting, you're working with something like JIRA so it makes sense to prefix a branch with a ticket (as a way to say "this branch is related to this story") and then a short human-readable description of the feature.

As a general rule of thumb, if your brain has to pause and make sense of a branch name, it's too complex.

Collapse
jasonkarns profile image
Jason Karns • Edited

Oof, ticket-based prefixes virtually eliminates the benefit of tab completion! Do you memorize ticket numbers? git co 9<tab> is not going to give me anything useful, nor will 97<tab> or 974<tab>. With ticket based prefixes you have to type every digit of the ticket number, down to probably the one's place. Given that most companies are probably in the thousands or more of tickets, you're typing at least 4 characters before you can even hope to get a completion match. I get cranky if I have to type more than 2 characters to get a completion match.

Collapse
cseeman profile image
christine

I could see it getting a little tricky. I usually do a git branch so I can see my local branches, and it makes it a bit better for typing it out, especially with the little quick summary blurb that is also in the branch naming. I do love my tab completion too!

Collapse
hardkoded profile image
Darío Kondratiuk Author

That's cool, I like it.