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:

[diff]
        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
https://musescore.org/en/node/22655

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.


Comments

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 @@
<durationType>whole</durationType>
<Note>
<linkedMain/>
- <pitch>72</pitch>
- <tpc>14</tpc>
+ <pitch>76</pitch>
+ <tpc>18</tpc>
</Note>
</Chord>
</voice>

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"

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