Last active
December 24, 2015 21:19
-
-
Save antespi/6864334 to your computer and use it in GitHub Desktop.
Git patching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get a patch from a git branch | |
============================= | |
Create a branch, or go to the branch in which we want to modify code | |
# git checkout -b fix_empty_poster | |
Make your changes, and see your commits in log | |
# git log --pretty=oneline -3 | |
Create the path from master branch (diff between master and fix_empty_poster) | |
# git format-patch master --stdout > fix_empty_poster.patch | |
Send the path to repository maintainer | |
Apply the patch in master branch | |
================================ | |
Look at what changes are in the patch | |
# git apply --stat fix_empty_poster.patch | |
Check if patch will cause troubles | |
# git apply --check fix_empty_poster.patch | |
Apply path | |
# git am --signoff < fix_empty_poster.patch | |
Apply the patch manually in code (not git installed) | |
==================================================== | |
# patch -p1 < fix_empty_poster.patch | |
References | |
========== | |
How to create and apply a patch with Git : http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ | |
How to apply `git diff` patch without Git installed? : http://stackoverflow.com/questions/3418277/how-to-apply-git-diff-patch-without-git-installed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment