1,打开终端,cd到项目目录下
2,touch .gitignore 创建忽略文件
3,回到工程中shift+command+. 打开隐藏文件,找到.gitignore文件
4,打开.gitignore文件,编辑写入:
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
5,保存关闭.gitignore文件
6,退出Xcode,在终端输入 git rm --cached YourProjectName.xcworkspace/xcuserdata/YourUsername.xcuserdatad/UserInterfaceState.xcuserstate
7,在终端输入:git commit -m"Removed file that shouldn't be tracked"
8,重新打开Xcode,git commit ,git push