when running git format-patch, the intent is to create an email representation of the code you wrote. So far so good. I'm no email expert, but it seems to me that the first line of this format-patch output isn't in a standard email header format...
From de8d128fb520416e0b029c913b3a5ce900d0320c Mon Sep 17 00:00:00 2001 Message-Id: From: Christopher Harvey Date: Wed, 3 Apr 2013 10:17:52 -0400 Subject: [PATCH 0/3] *** SUBJECT HERE *** To: Christopher Harvey *** BLURB HERE *** Christopher Harvey (3): commit 2 commit 3 commit 4 data | 3 +++ 1 file changed, 3 insertions(+) -- 1.7.12.4
what is From de8d128fb520416e0b029c913b3a5ce900d0320c Mon Sep 17 00:00:00 2001
? what is the date for? It looks arbitrary to me, and it also prevents me from piping it to sendmail. I have to manually remove that line each time I want to send a patch.
thanks.
The “git format-patch” command will check for commits that are in the branch specified but not in the current checked-out branch. As a consequence, running a “git format-patch” command on your current checkout branch won't output anything at all.
GIT patch or GIT diff is used to share the changes made by you to others without pushing it to main branch of the repository. This way other people can check your changes from the GIT patch file you made and suggest the necessary corrections.
Git Cola includes an "Apply Patches" dialog that can be launched from the Actions menu, or via the git cola am sub-command. You can open patches in this dialog and display the contents with diff syntax highlighting. This feature is available in master by cloning the repo and will be in the upcoming v3.
Git diff is a command used to output the changes between two sources inside the git repository. The data sources can be two different branches, commits, files, etc.
From git help format-patch
DISCUSSION The patch produced by git format-patch is in UNIX mailbox format, with a fixed "magic" time stamp to indicate that the file is output from format-patch rather than a real mailbox, like so:
From 8f72bad1baf19a53459661343e21d6491c3908d3 Mon Sep 17 00:00:00 2001 From: Tony Luck <[email protected]> Date: Tue, 13 Jul 2010 11:42:54 -0700 Subject: [PATCH] =?UTF-8?q?> > [IA64]=20Put=20ia64=20config=20files=20on=20the=20?= =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20diet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
As an appendix to Fredrik's answer, here are some relevant comments by Junio Hamano:
"Mon Sep 17 00:00:00 2001"
is just a fake random date to make the Unix-From line recognizable by common MUA and does not have anything to do with your commit objects. The real date is onDate:
header.
I actually once tried to change it to git's birthday (
Thu Apr 7 15:13:13 2005 -0700
) and I recall that it turned out that some people's scripts (or perhaps MUA) were broken and cared what was before "7" ... on the Unix-From line and discarded that update.
The
"From $SHA1 $magic_timestamp"
line and other header lines are there to make it look like a mbox
Links: 1, 2, 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With