Confirmed users
182
edits
(→How to do a merge?: Improved documentation, explaining a few things) |
|||
Line 17: | Line 17: | ||
You can't review your own code! | You can't review your own code! | ||
==How to do a merge?== | == How to do a merge? == | ||
Once a pull request ready to be pulled the following steps should be followed. | Once a pull request ready to be pulled the following steps should be followed. | ||
* Make sure that you have a clone of the Mozilla repository on your local machine | *Make sure that you have a clone of the Mozilla repository on your local machine | ||
* git branch pullrequest | *'''git branch ''pullrequest'''''<br> | ||
* git checkout pullrequest ... for the impatient, git checkout -b pullrequest | *'''This will create another branch (a working copy), called ''pullrequest'', with the code of the current branch) | ||
*'''git checkout '''''<b>pullrequest</b>'' ... for the impatient, '''git''' '''checkout -b ''pullrequest'''''<br> | |||
* git remote add requestee requestee_git_fork_url | Switches to your new branch ''pullrequest''. The reason for doing it in a branch is if there are conflicts it won't break you local master. If you should indeed mess up your branch, you can always create a new branch off your ''master'' branch!<br> | ||
* git fetch requestee && git merge requestee/pull_request_branch_on_their_fork | *'''git remote add '''''<b>requestee requestee_git_fork_url</b>'' | ||
* Run the tests | *''This command will introduce your clone of the repository with the repository you want to merge with (most of the time, this is the mozilla repository). '''''Example:'''''<b>git </b>'''remote add'''''<b>mozilla</b>'' '''''https://github.com/mozilla/Addon-Tests.git''''' will save the Addon-Test repository under the short, and easy-to-remember name ''mozilla''.<br> | ||
** Sometimes good looking code doesn't actually work so lets prove it works! | *'''git fetch''' '''''requestee''''' '''&& git merge''' '''''requestee/pull_request_branch_on_their_fork''''' | ||
** If, and only if, it passes do the next steps | *Get the latest data from the remote repository 'mozilla' and integrate it with your current working branch. '''''Example:''''' '''git fetch ''mozilla'' && git merge '''''<b>mozilla/master</b>'' will get all the stuff from the mozilla repository (1st step) and then merge the '''''master''''' branch of '''''mozilla''''' with the data of your branch, thus keeping it up-to-date! | ||
* git checkout master | *Run the tests | ||
* git merge pullrequest master | **Sometimes good looking code doesn't actually work so lets prove it works! | ||
* git push origin master | **If, and only if, it passes do the next steps | ||
* git branch -d pullrequest | *'''git checkout '''''<b>master (</b>''Switch to your ''master'' branch)'' | ||
*'''git merge '''''<b>pullrequest master</b>'' (Merge your branch (working copy)''pullrequest ''with the current master branch)<br> | |||
*'''git push ''origin master'''''(Push the changed stuff in your master branch back to your origin repository at github) | |||
*'''git branch -d '''''<b>pullrequest</b>''(Delete the working branch you created, as everything is now merged with your master branch) | |||
This will have it all stored in the remote master and you will have a clean version locally. Please **don't** use the merge button on GitHub. You **need** to verify that the merge works and that button can't do that for you! | This will have it all stored in the remote master and you will have a clean version locally. Please **don't** use the merge button on GitHub. You **need** to verify that the merge works and that button can't do that for you! |