In Order to submit Patches for Google Summer of Code , you must be comfortable in reading source code and finding Bugs/issues in them.Well every Organisation will have a Bug Tracker System that has a set of Solved and Unsolved Bugs/Issues which are usually labelled with their difficultly Level ,like first-Timer, Easy, Medium or Hard .In this Post we 'll be covering How to Create a Patch after you detected and worked on some Bugs / Issues .



In Order to submit Patches for Google Summer of Code , you must be comfortable in reading source code and finding Bugs/issues in them.Well every Organisation will have a Bug Tracker System that has a set of Solved and Unsolved Bugs/Issues which are usually labelled with their difficultly Level ,like first-Timer, Easy, Medium or Hard .In this Post we 'll be covering How to Create a Patch after you detected and worked on some Bugs / Issues .

Create Patch using Diff

Create Patch using WinMerge

Create Patch using Git

Create Patch using Diff :

import java.util.*; public class Foo { public void main(String[] args) { System.out.println("Foo"); } }

import java.util.*; import java.util.*; public class Foobar { public void main(String[] args) { System.out.println("Foobar Foo"); } }

diff -u Foo.java Foobar.java > PatchforFoo.patch

import java.util.*; --- Foo.java 2015-10-06 09:40:14.525429605 +0530 +++ Foobar.java 2015-10-06 09:43:29.365427829 +0530 @@ -5,7 +5,7 @@ public void main(String[] args) { -System.out.println("Foo"); +System.out.println("Foobar Foo"); }

diff -Naur /usr/src/originalfolder /usr/src/modifiedfolder > patchforgsoc.patch

Create Patch using WinMerge :

Create Patch using Git :

Many Organisations use Git Version Control has it is more secure and use distributed system for concurrent access . If you are new to Git version Control Try Git





To create patch in Git ,just open the Git console and if you want to create a patch file for last commit ,type git show > patchforgsoc.txt .

git diff commit1 commit2 > patchforgsoc.txt

git format-patch [options]

A Patch is simply a file usually a text file that has some additional information that you have added after manipulating your original file .If you made some changes to your original Code and wanted to share them with the Core Developers of the community (Organisation) then it is very helpful to provide them a Patch file .Now we know what is a patch , lets create one . Patches can be created in many ways .Some of them which are often used in Google Summer of Coding Contests are listed below :Diff is simple Linux command that requires two copies of code or a file .The first is the Original code or a file and later is the modified (With some changes you made) Code or a file .To illustrates this , we put the below code in the Foo.java File .Next , we modify the above code and save them in Foobar.java .To trace what changes you have made , just type in the Linux terminalThe above Code will create patch file called PatchforFoo which shows difference in contentsYou can also apply patch in Source Tree or directory .Type in the Linux TerminalAll those modified differences are placed in patchforgsoc patch file .WinMerge is a Simple Open Source GUI based Tool for Windows that is used to compare folder contents and merging. To start with ,first you need to download the WinMerge Software . To create the patch ,click FILE->Open and Open two versions for comparisons .then click TOOLS->Generate patch .If you want to create patch for 2 commits you can typeSo modified differences are placed in patchforgsoc.txt text file .In general the git patch format looks like this. Check the detailed explanation for git patch Options here