Getting a format-patch history in git

Posted on Thursday, September 4, 2014

Today I had a higher up want to have a record of my recent work.  They did not intend to do anything with it they just wanted a history.  I sent them a spreadsheet with tickets I had been working and a patch file from git .

I have never used patch files myself, so forgive my ignorance if I say something incorrect.

Create a patch to stdout

I can run a git command like this to create a patch from the last commit

    >  git format-patch HEAD~1 –stdout

You can pipe the output to a file

    >  git format-patch HEAD~1 --stdout > my.patch

You can also go back more than 1 commit in the history

    >  git format-patch HEAD~10 --stdout > my.patch

This will go back 10

Add to this a user filter, and you can get just your own code changes

    >  git format-patch HEAD~10 --committer=patman  --stdout > my.patch

I upped this to 1000 commits to make sure to get all my code changes

    >  git format-patch HEAD~1000 --committer=patman  --stdout > my.patch

This file is never intended to be used, but it is a history of the code changes  I had committed to our repository.

[1]  git-format-patch(1) Manual Page
       Visited 8/2014

No comments:

Post a Comment