xcode git 忽略user interface state文件

如果你看不到.git目錄,你需要讓隱藏的文件可見。具體做法就是打開一個Terminal窗口,輸入以下命令:

1.defaults write com.apple.finder AppleShowAllFiles TRU

2.重啟Finder

3.打開終端 切換到你的項目目錄下 刪除本地的UserInterfaceState.xcuserstate緩存

(1)sksdeMacBook-Pro:Sunny.xcuserdatad Sunny$ls

UserInterfaceState.xcuserstate

(2)sksdeMacBook-Pro:Sunny.xcuserdatad Sunny$git rm --cached UserInterfaceState.xcuserstate

rm 'uhou.xcodeproj/project.xcworkspace/xcuserdata/Sunny.xcuserdatad/UserInterfaceState.xcuserstate'

(3)sksdeMacBook-Pro:Sunny.xcuserdatad Sunny$git commit -m "Removed the stupid strange file that shouldn't be tracked"

[master d7762db] Removed the stupid strange file that shouldn't be tracked

1 file changed, 0 insertions(+), 0 deletions(-)

delete mode 100644 uhou.xcodeproj/project.xcworkspace/xcuserdata/Sunny.xcuserdatad/UserInterfaceState.xcuserstate

如果找不到可以手動打開到文件夾

(1)

(2)

(3)

(4)

(5)

直接 在終端cd ?拖拽Sunny.xcuserdatad到終端 ?然后就可以執行命令了

4.在同 .git目錄下創建.gitignore文件。

(1)切換到工程主目錄cd /Users/sks/Desktop/new_code/uhou1.0

(2)vim .gitignore 文件中加入如下幾行

*.xcbkptlist

*.xcuserstate

project.xcworkspace

xcuserdata

UserInterfaceState.xcuserstate

project.xcworkspace/

xcuserdata/

UserInterface.xcuserstate

5. 重新打開Xcode commit, push。

https://github.com/github/gitignore/blob/master/Objective-C.gitignore

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容