support for git diff, and later git merge

• Nov 24, 2020 - 20:35

I have started to store my jazz lead sheets in a git repository. I want to use this to collaborate with my friend in writing new and improving old existing scores. For this to work well, I need to be able to see the changes made on a file in a new commit.

I want to use "git difftool" to do this, and configure git to use musescore as the difftool. From the git perspective that would be quite easy I think. I could add something like this to the git configuration file:

        tool = musescore
[difftool "musescore"]
        cmd = MuseScore --diff $LOCAL $REMOTE

And since MuseScore suports showing the difference between two versions of the score that seems feasible But currently "--diff" on the command line cannot be used in this way.

I found this old request

But this is more about integrating git into MuseScore. What I propose is the reverse, to integrate MuseScore into git.

If this works out and is useful for others as well, there might a case for also supporting "merge", something like

MuseScore --merge $LOCAL $REMOTE $BASE $MERGED

where $BASE is the common ancestor, and $MERGED is the resulting merged file.


You can store your scores in an uncompressed (.mscx) format and use git right away without any further configuration. Diff and merge should mostly work well with the uncompressed format. It may be more difficult to deal with images embedded into a score (they cannot be stored as a part of .mscx file) but if you don't use them it should work well as it is.

Or do you want to make it possible to view differences between versions of the score directly in MuseScore?

In reply to by dmitrio95

Yes, indeed. I was not very clear in my initial post. I have already created a git repo and checked in some .mscx files. And the diff and merge works fine directly on the xml-files. The problem is understanding the diff. Suppose my friend sends me a pull-request, and the diff on his commit says

@@ -569,8 +570,8 @@
- <pitch>72</pitch>
- <tpc>14</tpc>
+ <pitch>76</pitch>
+ <tpc>18</tpc>

I only see that he has changed a pitch somewhere in the score from "72" to "76". It is quite difficult to determine if I should merge this pull-request or not, just based on this.

But MuseScore can show the difference between two versions of the score in a very useful way in the GUI, which would be perfect for this use case if it was just possible to invoke MuseScore from the command line with the two versions of the score and they would be shown in the diff-view in the GUI. As I tried to indicate in my original post, it would be possible to define musescore as a "diff tool" which would be invoked whenever I did a "git difftool"

In reply to by Jojo-Schmitz

Yes, except that that that ticket

  • First describes how to use the windows specific tortois-git frontend to git "to provide backups of our scores as protection against corruption caused by crashes during save" .
  • Then goes on to propose that there should be git features inside MuseScore ("versioning was integrated into MuseScore natively"). This is not part of my proposal. I am happy to handle MuseScore files (.mscx) as any other source code file using regular git (and any git frontend). I do not need or propose to have git versioning options in the MuseScore menues etc.

That ticket also briefly mentions:

3. Provide a WYSIWYG diff interface to show changes as musical scores rather than just xml code for easier diffing and merging.

This is related to my ticket, where I propose that this "WYSIWYG diff interface" should be possible to invoke from the MuseScore command line, to make it possible to integrate it into a regular git workflow, where a "git difftool" would invoke this GUI.

Do you still have an unanswered question? Please log in first to post your question.