-1

I have a repository. I want to apply its last commit to another repository on another machine. How can I retrieve the commit and apply it again?

Henry
  • 1,077
  • 1
  • 16
  • 41
  • You mean you want to `git format-patch` and `git am`? https://git-scm.com/book/en/v2/Appendix-C:-Git-Commands-Email – tueda Aug 02 '21 at 01:48

1 Answers1

0

I would use git diff.

Example:

  1. On your source repo : git format-patch HEAD~ : this will generate a patch file with the a 0001 prefix and the beginning of your commit message followed by the patch suffix.
  2. On the destination repo : git apply PATH_TO_PATCH
Thomas
  • 3,119
  • 2
  • 16
  • 22