2

I create an empty commit:

$ git commit --allow-empty -m "something important"

Sometimes it is useful, e.g. to coordinate 2 (or more) distinct git trees.

However, when I

$ git format-patch ...

Empty commits are omitted, as they are not associated with any code diff. Is there a way to include empty commits in a patch ? Thanks in advance !

segfault
  • 489
  • 4
  • 16

2 Answers2

0

It works for me. I made an empty commit, then a non-empty, both on top of an existing repo, then I did git format-patch @~4.. and it wrote out 4 commits, including the empty one, which is an empty file. Is the problem that the file is empty, and thus won't recreate the empty commit?

Gary Fixler
  • 5,632
  • 2
  • 23
  • 39
0

You can pass --always to git format-patch, but git am won't understand how to apply it still.

sdwilsh
  • 4,674
  • 1
  • 22
  • 20