2012-11-19 22 views
3

當我試圖提交我的代碼項目時,它顯示一個名爲'UserInterfaceState.xcuserstate'的文件,該文件必須提交。一旦我提交併嘗試將我的項目推送到git,Xcode給了我一個彈出消息,說'工作副本'應用程序'具有未提交的更改'。當我嘗試再次提交時,我得到相同的文件'UserInterfaceState.xcuserstate'再次提交。任何人都可以幫助我嗎?UserInterfaceState.xcuserstate在Xcode中使用git時未提交

回答

14

UserInterfaceState.xcuserstate就是Xcode中保存您的GUI的狀態,如窗口位置,打開的標籤,擴展節點項目檢查等

簡單地調整Xcode的窗口將導致此文件來改變和修飾被標記您的源代碼管理系統。您可以讓SCM系統忽略對項目本身不重要的特定文件。

您希望Git忽略該文件,您可以將其添加到.gitignore file,但必須刪除跟蹤。要停止跟蹤當前跟蹤的文件,請使用git rm –cached

git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate 
git commit -m "Removed file that shouldn't be tracked" 

之後的.gitignore將採取UserInterfaceState.xcuserstate 效果現在起,你不會看到一個彈出消息說,'The working copy "app" has uncommitted changes.'