美文网首页
Git提交时忽略频繁更新的UserInterfaceState.

Git提交时忽略频繁更新的UserInterfaceState.

作者: 114105lijia | 来源:发表于2019-07-17 18:08 被阅读0次

用过Git的人都清楚,只要运行一遍app,即使啥都没做,也会有修改,就像下面这样:

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    vkoov.xcworkspace/xcuserdata/miniso_lj.xcuserdatad/xcschemes/
    vkoov/vkoov.xcodeproj/xcuserdata/miniso_lj.xcuserdatad/

no changes added to commit (use "git add" and/or "git commit -a")

着实烦人。下面我们通过添加.gitignore文件来忽略该修改。

1.首先查看项目目录下是否有.gitignore文件.

command+shift+.      //查看隐藏文件(.gitignore为隐藏文件)

如果存在.gitignore文件,就直接看第3步,否则就创建.gitignore文件

2.创建.gitignore文件

touch .gitignore    //创建.gitignore文件
open .gitignore      //打开.gitignore文件

粘贴下面内容:

# Xcode
.DS_Store
*/.DS_Store
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate

*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout

#CocoaPods
Pods
!Podfile
!Podfile.lock
!Manifest.lock

保存并退出。

3.执行下面命令

git rm --cached [YourProjectName].xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"
git push

ps:如果不知道git rm --cached后面一串路径,可以查看最上面的那一串。或者执行命令git status查看。

相关文章

网友评论

      本文标题:Git提交时忽略频繁更新的UserInterfaceState.

      本文链接:https://www.haomeiwen.com/subject/vfptlctx.html