2

Given a repository like this:

A--B--C--D--E--HEAD

I want to use git format-patch to export only commit C. What would be an easy way to specify this commit?

From what I can tell, git format-patch <sha1 of B> <sha1 of C> would work, but that's pretty cumbersome (juggling with two hashes). Isn't there an easier way to specify this, something like "give me all commits immediately following B"?

I use Git 1.7.1 and would prefer solutions for this version; but if newer versions have substantial improvements in this area, this might be interesting as well.

oliver
  • 5,451
  • 8
  • 41
  • 48
  • Good find! While I don't understand _why_ it works :-/ , `git format-patch -1 ` as stated in http://stackoverflow.com/a/6658352/2148773 appears to work for my case. Can someone mark my question as duplicate? – oliver Apr 28 '14 at 13:38

1 Answers1

1

You should be able to work with C and "parent of C":

git format-patch C~ C
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283