git patch 使用
从某个commit生产patch
1 | git format-patch --stdout -1 <SHA> > what_do.patch |
应用patch,并stage
1 | git apply --index what_do.patch |
patch包含多个commit , git am 应用并自动提交,一般大家都喜欢git am!!
1 | git am -3 < your_patch_file.patch |
the -3 will do a three-way merge if there are conflicts. At this point you can do a git mergetool if you want to go to a gui or just manually merge the files using vim (the standard <<<<<<, ||||||, >>>>>> conflict resolution).