Skip to content

Instantly share code, notes, and snippets.

@jms
Created June 4, 2020 17:55
Show Gist options
  • Save jms/b8b0bcb002ce914f4981e4a32115f6f6 to your computer and use it in GitHub Desktop.
Save jms/b8b0bcb002ce914f4981e4a32115f6f6 to your computer and use it in GitHub Desktop.

Revisions

  1. jms created this gist Jun 4, 2020.
    17 changes: 17 additions & 0 deletions generate patch with git
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # generate a patch from you feature branch

    git checkout feature-branch
    git format-patch --stdout [development branch] > feature-branch.patch

    # verify the patch
    git apply --stat feature-branch.patch

    # dry run to detect errors:
    git apply --check feature-branch.patch

    # apply the patch to a new branch
    git checkout -b new-branch
    git am feature-branch.patch

    # apply the patch to a new branch using signoff, useful
    git am --signoff < feature-branch.patch