Create a patch from a commit

Asked

Viewed 711 times

5

When executing the command git apply it is possible to create a commit with changes from a text file:

git apply ~/Downloads/patch.txt

How do I create this patch from a commit existing?

  • I’ll look here a little bit about git format-patch, which is the command I use for this

1 answer

4


As quoted in the question comments, just use the command git format-patch according to the git manual, it can be used in many ways, but I believe the main ones are:

git format-patch <commitish_inicial>

or

git format-patch <commitish_inicial>..<commitish_final>

So the git generates one or more files in the format 0000-algo-como-a-msg-de-commit.patch which can be applied with git apply.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.