4

Somewhere else there was a discussion on putting several projects in one large repository. My question is, how does a good commit message look in those type of repos?

I usually prepend each commit message (via git hook) with a JIRA story ID [XYZ-123] and then add the information about the commit. However, having 10 or 20 projects in one repository, makes it difficult to know to which project is the commit referring. Adding a project name in the commit message might be a possibility, at the cost of reducing the comment space.

How have other programmers dealt with this?

2
  • 1
    I'm going to point out that the somewhere else was from '12. This question seems to be another discussion or poll and discussions and polls don't work well in the Q&A format. Could you edit the question to describe the problem you are having so that this can more closely fit to the Q&A format?
    – user40980
    Commented May 21, 2015 at 21:49
  • 1
    Don't you have one JIRA project per actual project? So the answer is, you should be able to sort it out based on the XYZ portion of the JIRA ticket id. Commented May 21, 2015 at 21:59

1 Answer 1

2

I don't think the projects in that question are the same as the ones in your case.

The project's in that question are build projects - they are all different components of the same application, divided into projects for the ease of building and releasing. Such projects, even when placed in different repositories, should share the same project in the ALM, because tickets rarely map cleanly to a single component:

  • When you open a feature request ticket, implementing it often requires modification of multiple components. Having to open tickets in all the different projects is not only cumbersome but also splits the design discussion into many comment sections and makes it hard to follow.
  • When you open a bug ticket, you can only guess what component the bug belongs to until you investigate - and you don't want to postpone the ticket opening until that investigation(which might be done by someone other than the ticket opener) is done. Also, while not as often as new features, some bugs do need fixing in multiple components.

In your case, since you find it reasonable to have a JIRA project for each project, I'm going to assume they are actual projects, each an application of it's own. If I'm right - you shouldn't put them all in the same repository! It has a very important benefit in the question you referred to - it allows to put in the same commits changes to multiple components that depend on each other. But in your case this is simply not relevant - there is no justification to have commit messages that look like:

- Add UTF-32 encoding support to SuperTextEditor
- Fix weird crash in AwesomeMusicPlayer
- Switch the default browsing algorithm in AmazingArchiver

These are all different changes to different projects that belong to different commits, and there can be no reason ever for you to want to bundle them together in the same commit - these projects should be each in it's own repository.

Putting multiple projects in the same repository is SVN thinking. SVN is a horrible SCM with a terrible design that forces you to use some gruesome hacks or else you won't find the mental strength to resist the argue to leave your 10th floor office from the window instead of the door. Putting multiple projects in one repository is one such hack, used mainly because it's so hard to keep track of multiple SVN repositories. Git doesn't have that problem - so just use separate repositories for separate projects!

3
  • While your solution is the ideal answer, the person asking the question might not be in a position to effect this change at this time. The JIRA ticket commit string is a straightforward solution. Commented May 21, 2015 at 23:57
  • 1
    The rant against SVN in your last paragraph just lost you an upvote. Commented May 22, 2015 at 5:51
  • 2
    @BartvanIngenSchenau It was worth it
    – Idan Arye
    Commented May 22, 2015 at 18:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.