Vlad Fedin
Vlad Fedin

Reputation: 528

How to use git format-patch on initial commit

I need to get patch file for inital commit (which is not empty) for our review process, but I'm confused as git format-patch command only makes it from branch that is on initial commit not including it.

Seems it must be some obvious move but I'm completely missing it.

Upvotes: 27

Views: 7712

Answers (3)

hochl
hochl

Reputation: 12930

Maybe this has changed, but

git format-patch --root

just created all patch files including the initial commit and HEAD. My git version is 2.26.2.windows.1.

Upvotes: 4

user1539634
user1539634

Reputation:

for making patch for a single commit just use

git format-patch -1 HEAD # where "1" is a number, not "ell".

where "HEAD" could be changed to any other commit, or even hash code. This works even if HEAD is the first commit. I am not sure whether you are asking for this.

Upvotes: 8

Lily Ballard
Lily Ballard

Reputation: 185681

Try git format-patch --root $SHA (where $SHA is that first commit)

Upvotes: 30

Related Questions