Sunday 29 January 2012

GIT PATCH FILE

Well , this is quick and dirty. Probably, I will add more information to it. But suppose consider the following:

Your manager says that he/she wants the digest of the commit you have just made before pushing the code to the repository. He/She will review it and tell more about it. You can probably zip your changed files and send him/her to review.

Git comes with a really nice alternate, the git patch files. To come up with it, just
do:

1) git add
2) git commit -a
3) git format-patch -1

-1 says that you want to create a patch file(containing all the git diffs) for the last commit.

-2 creates a patch file for 2 most recent commits and so on.

Now, he/she can just do

git apply <patch file path which you probably emailed>

That would create an exact same commit at his end and then she can see all the code that you have just written for a new critical feature/bug.
Please post any questions or updates.

Hope it helps.
Keep blogging
Cheers

No comments:

Post a Comment