Forrest logo
back to the git tool

git-format-patch:tldr:5fe8c

git-format-patch: Write a `.patch` file for all the commits between 2 revisions to `stdout`.
$ git format-patch ${revision_1}..${revision_2}
try on your machine

The command "git format-patch ${revision_1}..${revision_2}" is used to generate patch files for reviewing or sharing changes between two git revisions or commits. Let's break down the command:

  • "git format-patch": This is the command to generate patch files in Git.
  • "${revision_1}..${revision_2}": It specifies the range of revisions you want to generate the patch files for. You need to replace "${revision_1}" and "${revision_2}" with the actual revision names or commit IDs.

The ".." in between the two revisions specifies a range of revisions. It indicates that you want to generate patch files for all the commits between "${revision_1}" and "${revision_2}", including both ends.

For example, if you have two commits with IDs "abc123" and "def456", and you want to generate patch files for all the changes between them, you would use the command:

git format-patch abc123..def456

This command will create one or more patch files, each containing the changes made in a specific commit, in chronological order. These patch files can be used to apply the changes to another repository or shared with others for review purposes.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool