1# Submit a Patch to oss-fuzz repo 2 3## One-time Setup 4 51. Create github account if needed (with @google.com email address, preferably) 6 and log in. 71. To allow “git push” to work, you’ll have to add an SSH key: 8 https://help.github.com/articles/connecting-to-github-with-ssh/ 91. Go to https://github.com/google/oss-fuzz and click on “Fork”. 101. Go to your own fork of the repo, which will be at 11 https://github.com/\<git_username\>/oss-fuzz 121. Click on “clone or download” and pick “Clone with SSH” method (I found that 13 easier to use for “git push”). Then copy that URL and run “git clone \<URL\>” 14 in terminal. Now you have a local repo, and **your fork** of the remote repo 15 will be called “**origin**” in your git config. 161. Configure a remote repo pointing to the **upstream repo** 17 (https://github.com/google/oss-fuzz) so that it’s called “**upstream**”: 18 * cd \<local_oss_fuzz_repo_directory\>/oss-fuzz 19 * git remote add upstream git@github.com:google/oss-fuzz.git 20 * git remote -v 21 22NOTE: For trivial changes it's possible to edit the files in the web UI on the 23main project and create a commit + pull request from that. 24 25## Workflow for a Pull Request (Patch) 26 271. Go to your repo: 28 * cd \<local_oss_fuzz_repo_directory\>/oss-fuzz 291. Create a new branch: 30 * git checkout master 31 * git checkout -b new_feature_xyz 321. Make your changes and commit them locally with “git commit” 331. Push your changes to your fork on github 34 * git push -u origin HEAD 35 * (This will create a branch of the same name “new_feature_xyz” on your 36 fork “origin”). 371. Open your fork in browser and click on “Compare & pull request” and follow 38 the prompts. 391. If changes are requested to the patch: 40 * make changes to the same local branch 41 * commit them locally with “git commit” (but DO NOT amend!) 42 * git push -u origin HEAD 431. Once pull request is closed: 44 * Delete “new_feature_xyz” branch on your fork using the “Delete branch” 45 button on the pull request 46 * Delete local “new_feature_xyz” branch locally with “git checkout master 47 && git branch -D new_feature_xyz” 48 * Sync your local repo and your fork with upstream repo: 49 * git checkout master 50 * git fetch upstream 51 * git merge upstream/master 52 * git push origin master 53