2009
11.06

Apply patch

PATCH=patch_filename ; git am $PATCH || (git apply --reject $PATCH ; find -name *.rej)

It’s done, if no .rej files be produced.

If git am failed, it’ll try to apply the other successful part and produce the .rej files to indicate the failed part.

Edit the failed files then, and using git status to make sure how many files infected and using git add files to add them or using git add -u to add all not updated files.

Finally, git am --resolved

Note for the zsh user. (2010/01/12)
I changed my default shell to zsh recently and found the apply patch command is broken. Although zsh claim that it’s compatible with bash, there are still some difference. But the good news is we can overcome this problem by adding one more line in the .zshrc
setopt GLOB_SUBST
More detail, please read this

No Comment.

Add Your Comment

Spam Protection by WP-SpamFree