Creating and applying patches with git
Creating and applying patches using git is a task relatively easy to do. I will show how it all works using an example scenario.
Let’s say we have a main repository with just one commit on it:
1
2
adrian@laptop:~/repository$ git lg
* ff4c135 - (HEAD, master) first commit (2012-04-12 19:14:39 -0700) <Juanito>
That repository has been copied by other people that are working on the same project. Now lets say that I am the one that cloned the main repository and did some work on it:
1
2
3
4
adrian@laptop:~/copy$ git lg
* be3ec44 - (HEAD, origin/master, origin/HEAD, master) Third commit (2012-04-12 19:16:28 -0700) <Adrian>
* 1551977 - second commit (2012-04-12 19:16:00 -0700) <Adrian>
* ff4c135 - first commit (2012-04-12 19:14:39 -0700) <Juanito>