ios git用sourcetree忽略不必要檔案
阿新 • • 發佈:2019-02-10
在ios開發中,會有一些不需要提交到git上的檔案,如:UserInterfaceState.xcuserstate這類的檔案。
如果當前git伺服器中沒有這個UserInterfaceState.xcuserstate檔案,我們可以直接在sourcetree中指向這個檔案--右鍵--ignore。如果當前這個檔案已經存在伺服器中,我們需要先刪除在git伺服器中的該檔案,然後再忽略。
1.刪除倉庫中跟蹤的UserInterfaceState.xcuserstate
git rm --cached /Users/kyo/Documents/IOS\ Development/protect/Git/JuMi/JuMi.xcodeproj/project.xcworkspace/xcuserdata/kyo.xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"
git push
2.忽略UserInterfaceState.xcuserstate,在倉庫根目錄下:
vim ./.git/info/exclude
然後按“i”進入編輯模式,將UserInterfaceState.xcuserstate追加到檔案末尾,注意要填寫專案相對路徑也可以再sourcetree中指向這個檔案--右鍵--ignore
最後,感謝下http://www.tracefun.com/blog/?post=9