git生成patch文件



1  使用git format-patch生成所需要的patch:
當前分支所有超前master的提交:
git format-patch -M master
某次提交以後的所有patch:
git format-patch 4e16                --4e16指的是commit名
從根到指定提交的所有patch:
git format-patch                          --root 4e16
某兩次提交之間的所有patch:
git format-patch 365a..4e16      --365a和4e16分別對應兩次提交的名稱


2 應用patch:
先檢查patch文件:git apply --stat newpatch.patch
檢查能否應用成功:git apply --check  newpatch.patch
打補丁:git am --signoff < newpatch.patch

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章