Quick walkthrough of how to use git patching.
REF: 85_patches/README.md
TODO:
- Be careful with binary files
- Patching single files or a selection of files
Creating patch files.
# create a patch for the difference
git format-patch HEAD~1
# calculate single patch for branch (without -1 each commit is a patch)
git format-patch -1 $(git merge-base --fork-point master)..mybranchCreate a patch of unstaged files.
git config --global alias.make-patch '!bash -c "cd ${GIT_PREFIX};git add .;git commit -m ''uncommited''; git format-patch HEAD~1; git reset HEAD~1"'
git make-patch
git diff HEAD > file_name.patch# applying a patch
patch -p1 -i patches/image-js+0.33.1.patch
# git apply only works for files in index.
git apply --ignore-whitespace patches/image-js+0.33.1.patch