Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum length of a Github branch name

Tags:

github

I could not find any documentation on what the maximum length of a Github (not Git) branch name is. So, what is it?

like image 961
okor Avatar asked Feb 03 '20 18:02

okor


Video Answer


1 Answers

Answer: 62-250 characters

Explanation: The most technically correct answer is 250 bytes. To arrive at this conclusion, I just brute forced branch names of various lengths and characters to figure out what the Github limit is. When using a string composed of purely valid ASCII character, the limit is 250 characters which totals 250 bytes if we assume UTF-8 encoding is being used. When using all 32-bit/4-byte Unicode characters (all 😊 characters in my test), the limit is 62 characters which totals 238 bytes. While I didn't test it explicitly, I think it's safe to assume the same rules apply to any arbitrary mix of characters - total bytes being the constraint, not character count.

like image 137
okor Avatar answered Sep 23 '22 08:09

okor