I'm tired of all those issue tracking systems that can only be used online or via email, so I've been looking at keeping track of issues in a database that can be replicated and merged (so it can be used offline).
To make my life easier, I figured I should reuse existing tools using such a database, and Git came to mind. But for it to work well, it's important that the "merges" don't generate too many conflicts, i.e. that Git's built-in algorithms to merge branches be used wisely.
As of now, I figured that the various messages in a given issue shouldn't be kept in files (keeping them all in a single file would lead to conflicts in that file, and keeping them in separate files would lead to difficulty keeping them ordered) but should instead be stored in the commit-messages, so there can't be a conflict because of those messages and git log <issue-dir>
will naturally show me the messages in the right order.
But the problem now is that I need to make sure the commit message is associated with the right "issue directory" (where I keep the rest of the data, i.e. mostly the state of the issue). For that I need to make sure the commit modifies some file in that directory, but if the new message doesn't affect the state of the issue, there might not be any file that needs to be changed, so I'd have to articifically modify a file, which brings back the risk of introducing a conflict. Any idea how to tell Git that an "empty commit" should be associated with a particular subdirectory?
OK, I did not find a clean way to link an empty commit's message with a particular directory, other than by adding some dummy file which was just too ugly for my taste.
But I ended up solving a slightly different problem: instead of having a separate directory per bug, I placed every bug in its own branch. This way, there's no need to perform any gymnastics to match commit messages to particular bugs. Additionally, that avoids artificially interleaving commit messages from different bugs, and makes it possible to git merge
bugs, or to share some subset of bugs between different bug databases.
If interested, I've put my code up at https://gitlab.com/monnier/bugit