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到終端 ?然后就可以執(zhí)行命令了

4.在同 .git目錄下創(chuàng)建.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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容