最近我從SVN遷移到git,我的團隊已經開始在新鮮的git倉庫中工作。如何將Git補丁應用於已更改歷史記錄的存儲庫?
後來我發現了轉換的一些問題,並從SVN做了第二個git repo,並進行了一些修復和歷史重寫。
現在我有第二個SVN回購(我很滿意)的git副本,我想修補它與我的團隊在第一個git存儲庫中所做的更改。
對於這樣的目的,我嘗試使用git補丁:
git-format-patch --zero-commit --stdout > master.patch
創建其已經以1混帳的master
回購- 和
git-am
作出從*.patch
文件應用提交更改的 單個文件在master
第二個存儲庫
我指定--zero-commit
,因爲補丁文件中的哈希將是錯誤的,我實際上有兩個不同的儲存庫。
的問題是,當我嘗試用git am master.patch
應用補丁,我得到:
Applying: %commit_name% error: patch failed: readme.md:5 error: readme.md: patch does not apply Patch failed at 0001 %commit_name% The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
即使我只有一個在這個補丁提交,我想它適用於同一回購來獲得相同承諾,但在另一個分支。