Submit a Pull Request - musescore/MuseScore GitHub Wiki

If you have made changes to the code that you want to share with us then you need to create a pull request (PR) on GitHub.

Firstly, you must have followed all the steps in Get MuseScore's source code so that you have a fork of the repository on GitHub and a local copy on your machine. Naturally, you should also have compiled and edited the code.

Create the PR

Create a local branch

Changes should not be made on the master branch, so create a new one with an appropriate name relating to the change (e.g. play-panel, note-input, transposition, etc.).

git checkout -b branch-name

Push to your remote fork

git push origin branch-name

Visit GitHub to create the PR

Use the "Compare & Pull Request" button on your forked repository page.

Update the PR

Push to same branch

You can update an existing PR by pushing to the same branch on GitHub. Please do this instead of creating a new PR.

git push origin branch-name     # normal push
git push -f origin branch-name  # force push

You might have to "force push" (use -f option to git push) if you changed an existing commit rather than just adding new commits.

Rebase on latest upstream code

git pull --rebase upstream master

If you are rebasing to run the CI tests again, follow this with a force push

Squash commits

You might have numerous commits on your Pull Request (or your branch). To quite literally squash those commits into a single one:

git rebase -i HEAD~3  # perform an interactive rebase on last 3 commits

This results in a new interface showing the last 3 commits on your branch. Each commit is preceded by pick:

pick 5ce6edc274 first_commit
pick 195db66b9a second_commit
pick 1912836a12 third_commit

This interface is actually a text editor (usually vi or nano) running inside your terminal. You need to edit the file to tell Git what you want to do with each commit. The options include pick, squash, edit and drop, and their meanings are explained in comments further down the text file. You can even rearrange commits in the editor to change their order in the history.

When you replace pick in the second line with squash, you are going to squash the second commit onto the first. So if you want to squash the second and third commit onto the first, replace the pick with squash in the second and third lines.

  • If you're editing in nano then you can replace the text right away just by typing.
  • If you're in vi you'll need to press I to get into insert mode before you can replace the text.

Once this is completed, you need to save the file and close the editor.

  • In nano, press ^O (Ctrl+O) to output the file, followed by Enter to use the default filename, then ^X (Ctrl+X) to exit nano.
  • In vi, press Esc (Escape) to leave insert mode (i.e. return to command mode), then type :wq to write the file and quit the editor.

Since you chose to squash some commits (i.e. replace them with one big commit), another text file will open for you to type a commit message for the new commit. Type the message and delete (or comment out) any lines that you don't want to keep from the default message, then save the file and quit the editor as before. Use git status to check that the rebase was complete, followed by git log and git show to check that it did what you wanted.

If you already have a PR open with the unsquashed commits, you need to force push to update it with the squashed one:

git push -f origin branch-name

Squashing the last X commits

If you want to squash your last X commits into one commit using Git, first rollback all the changes made in the last X commits. All changes will be automatically staged by Git.

git reset --soft HEAD~{NUMBER_OF_COMMITS}

Then commit all the changes together.

git commit -m "{COMMIT_TITLE}"

If you have a PR open with multiple commits to be squashed, you also have to force push.

git push -f origin branch-name
⚠️ **GitHub.com Fallback** ⚠️