git patch study

gen patch

  1. use git log --pretty=oneline -3 list commit
    gen patch after e7819 commit not include e7819, this may be gen several files.
  2. gen patch git format-patch e7819
    if you want gen only one file use following command
    git format-patch master --stdout > fix_empty_poster.patch

between two commits patch:
git format-patch 365a..4e16

apply patch

  1. copy .patch files to a folder

  2. take a look at what changes are in the patch
    git apply --stat patch/*.patch

  3. test before actually apply
    git apply --check patch/*.patch

  4. git am --abort abort earlier am process

  5. git am patch/*.patch

git am --signoff < fix_empty_poster.patch