View Single Post
thp's Avatar
Posts: 1,391 | Thanked: 4,272 times | Joined on Sep 2007 @ Vienna, Austria
#58
Originally Posted by aligatro View Post
Yup, it is simple. Just an if statement with else. How do you create patches? Do you somehow compare it to git or you have two folders to create a comparison. Btw same goes for Mohammad.
There are multiple ways to do it (as you can already see from this post). My favourite method is to "git init" and "git add *" the directory before I make any change (of course this is unnecessary if you are already working in a Git checkout). Hack, hack, hack. After that, check your changes with "git diff" and if you like them, make a commit (don't forget to "git add" any changed and new files). After that's done, you can use "git format-patch" to create patches. Alternatively, if you have not added any new files, you can simply redirect the output of "git diff" to a file and use that as a patch.

The good thing with "git format-patch" is that you simply keep committing small changes on top of each other, and you could even "git rebase" your changes if there is activity in upstream, and still get all your patches spit out at once, in the right order.

Of course, you don't have to use "git", and a unified (-u) recursive (-r) diff of the original source folder and your changed source folder works just as well for one-off patches, but it gets more comfortable as the number of patches grows (and as a side effect, you can publish your private branch as normal Git repository somewhere online for others to pull/follow - in that case it would be useful to base your changes on the original upstream VCS history instead of using "git init" on a release tarball).
 

The Following 2 Users Say Thank You to thp For This Useful Post: