Git遇坑填坑系列
1、git 出現 fatal: refusing to merge unrelated histories 錯誤
git pull 失敗 ,提示:fatal: refusing to merge unrelated histories
其實這個問題是因爲 兩個 根本不相干的 git 庫, 一個是本地庫, 一個是遠端庫, 然後本地要去推送到遠端, 遠端覺得這個本地庫跟自己不相干, 所以告知無法合併
-
一個種方法: 是 從遠端庫拉下來代碼 , 本地要加入的代碼放到遠端庫下載到本地的庫, 然後提交上去 , 因爲這樣的話, 你基於的庫就是遠端的庫, 這是一次update了
-
第二種方法:
使用這個強制的方法
git pull origin master --allow-unrelated-histories
後面加上 --allow-unrelated-histories
, 把兩段不相干的 分支進行強行合併
後面再push就可以了,但是執行完上述命令,會多兩個commit
關於這個問題,可以參考http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories。
在進行git pull 時,添加一個可選項
git pull origin master --allow-unrelated-histories
2、pod trunk時遇到錯誤
主要是cocoapods的版本問題,使用1.2.1