gitgithubversion-controlcommitcollaboration

Is there a limit to the number of co-authors in a commit message?


I'm working on a project with a large team and we're using Git for version control. For collaborative work, we often have multiple co-authors for a single commit. I'm curious if there's a limit to how many co-authors can be included in a commit message.

How many Co-authored-by lines can I include?


Solution

  • The Co-authored-by lines are simply part of the body of the commit message (they're called trailers) and as such, the functional Git limitation is on the size of the commit object. If you would like your commit to be readable on 32-bit systems, then the limit is around 2 GiB (some address space must be available for other data).

    However, as a practical matter, GitHub (and, generally, most hosting sites) will be displeased if you push very large commits because large objects make anything that packs data (including repository maintenance and serving requests) very slow when deltifying. GitHub uses git-sizer to determine the shape of repositories (and you can, too), and from looking at the code, it looks like the point at which you get a high score of all exclamation points (not a good sign) is 50 KB (50e3). I've seen commits larger than a megabyte, which I don't recommend.

    I'm not aware if there's an actual limit on the number of co-authors specifically, but there are other limits in place (say, on the sizes of objects fetched for UI and API processing) and a large number of co-authors may not be rendered in the UI.

    Looking at the most recent 100 commits in git-sizer, the size of Co-authored-by lines for each of the authors is 5460 bytes. Assuming you write excellent, very thorough commit messages, that's probably another 5 KiB. I think that a 10 KiB commit message is reasonable in the context, even though 100 commit authors would not be reasonable. If you are writing reasonably sized commits (single, logical changes, as recommended by the Git project) and your developers are not members of a hive mind, then there's probably not a practical limit that should affect you.