Skip to content

Instantly share code, notes, and snippets.

@gquittet
Created January 9, 2026 13:15
Show Gist options
  • Select an option

  • Save gquittet/65920b4c2977793e72d7d8faa736f206 to your computer and use it in GitHub Desktop.

Select an option

Save gquittet/65920b4c2977793e72d7d8faa736f206 to your computer and use it in GitHub Desktop.
Git extract commit changes to apply them to another project.

To extract the changes that are in a specific commit and apply them in another project, run

git format-patch -1 commit_sha

That will generate a .patch file for the specific commit.

Then to apply it, just run:

patch -p1 < 0001-file.patch

I've tried cat 0001.patch | git am, and so on but nothing was working.

The only command that is running fine to apply the changes is using the patch command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment