Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reformat regular diff patch to git format

Tags:

git

diff

patch

Is there an easy way to reformat a regular (unified) diff patch into a git-format patch? What I want to do, is take a regular patch someone sends me and apply it with git, adding author information – as if it were a git-format patch.

I don't really want to start manually rewriting the patch, so I was wondering if there is perhaps a git command I haven't found out about yet that does this.

It seems like a problem others must have had before...

Thanks!

like image 589
wvh Avatar asked Feb 28 '11 00:02

wvh


1 Answers

git apply < patch; git commit; git format-patch HEAD^
like image 73
Tobu Avatar answered Oct 14 '22 01:10

Tobu