Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Submitting a Patch

Collins Abitekaniza edited this page May 13, 2018 · 3 revisions

All patches are submitted using github pull requests feature. To do that you have to have the fork of the Shumway project.

Preparing git clone

If you already cloned a repo using git clone https://github.com/mozilla/shumway.git command, reconfigure it using following steps (where $GITUSER is your user name):

# define new origin
git remote rm origin
git remote add -f origin [email protected]:$GITUSER/shumway.git
# git remote add origin https://github.com/$GITUSER/shumway.git

If you didn't clone Shumway yet:

# clone the repo
git clone [email protected]:$GITUSER/shumway.git
# git clone https://github.com/$GITUSER/shumway.git
cd shumway

After the origin is set and repo is configured:

# define upstream repo
git remote add -f mozilla https://github.com/mozilla/shumway.git

Syncing your master with mozilla/shumway

To keep you local master in sync with Mozilla's Shumway master perform the following command.

git checkout -B master mozilla/master
git pull

All new commits introduced into your local master with be lost.

Create a new branch

Every new patch or feature deserves a new branch. Please create one, so you will be able to submit multiple pull requests at once. To create a branch:

git checkout -b new-branch-name mozilla/master

Create a commit

Use git add, git rm, git commit to create a patch/commit. If it's hard for you to use the command line tools, you can use any available GUI tool (e.g. git gui). Please provide good comment/message about what this patch fixes.

Push branch to your repo

To make patch visible to github.com, you have to push the created branch to your repo:

git push origin new-branch-name

After that you will be able to locate and review the changes using github.com interface and submit them as a pull request.

Appending changes

You can add more changes/commits into the same branch. See "Create a commit" above. If you push the branch to your repo again, the changes will appear in the pull request you already created.

If you want to submit a patch for different feature, create a new branch with different name. To switch between branches use git checkout other-branch-name command.

Merging with master

Sometimes there is a conflict and it's not possible to apply the submitted patch to the mozilla/master. To merge your current branch with the master:

git fetch mozilla
git merge mozilla/master

Resolve conflict, make commit and push branch to your repo.

Squashing the commits

Sometimes you will be requested to squash you commits into one. Don't panic. First merge your branch with the master (see section above), only then:

# resets HEAD to the current upstream
git checkout mozilla/master
# merges all commits from the local branch
git merge --no-commit --squash branch-name-to-squash
# re-creates the branch starting from current HEAD (old commits will be lost)
git checkout -B branch-name-to-squash
# lets you edit the commit and checks in the changes (you can also use git commit -m "message")
git commit -e
# pushes the changes (in general, be careful with the --force parameter)
git push --force origin branch-name-to-squash

If you don't do any merges, you can just use git rebase -i HEAD~<n> instead (where <n> is amount of commits to change).