最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]git中的.gitignore文件

Git crifan 4666浏览 0评论

折腾:

[记录]Xcode中git merge branch到master上

期间,要去搞懂git中的 .gitignore文件

搜:

git .gitignore

Git – 记录每次更新到仓库

Git Book 中文版 – 忽略某些文件

licrifandeMacBook-Pro:iOS-Client crifan$ cat .gitignore
cat: .gitignore: No such file or directory
licrifandeMacBook-Pro:iOS-Client crifan$ vi .gitignore
licrifandeMacBook-Pro:iOS-Client crifan$ ls -la
total 40
drwxr-xr-x    7 crifan  staff    238  3  1 11:25 .
drwxr-xr-x    8 crifan  staff    272  2  1 11:41 ..
-rw-r–r–    1 crifan  staff  10244  3  1 11:11 .DS_Store
drwxr-xr-x   14 crifan  staff    476  3  1 11:25 .git
-rw-r–r–    1 crifan  staff     31  3  1 11:25 .gitignore
drwxr-xr-x  302 crifan  staff  10268  3  1 11:11 JianDao
-rw-r–r–    1 crifan  staff     13 10 27 11:39 README.md
licrifandeMacBook-Pro:iOS-Client crifan$

果然包括了刚才添加的:

licrifandeMacBook-Pro:iOS-Client crifan$ git status –ignored
On branch v1.0
Your branch is up-to-date with ‘origin/v1.0’.
Unmerged paths:
  (use "git reset HEAD <file>…" to unstage)
  (use "git add <file>…" to mark resolution)
both modified:   JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/UserInterfaceState.xcuserstate
Untracked files:
  (use "git add <file>…" to include in what will be committed)
.gitignore
JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/WorkspaceSettings.xcsettings
JianDao/JianDao.xcodeproj/xcuserdata/crifan.xcuserdatad/xcdebugger/
Ignored files:
  (use "git add -f <file>…" to include in what will be committed)
JianDao/JianDao/Assets.xcassets/.DS_Store
JianDao/JianDao/Assets.xcassets/AddPerson/.DS_Store
JianDao/JianDao/Assets.xcassets/Contact/.DS_Store
JianDao/JianDao/Assets.xcassets/Conversation/.DS_Store
JianDao/JianDao/Assets.xcassets/DropDownList/.DS_Store
JianDao/JianDao/Assets.xcassets/File/.DS_Store
JianDao/JianDao/Assets.xcassets/My/.DS_Store
no changes added to commit (use "git add" and/or "git commit -a")
licrifandeMacBook-Pro:iOS-Client crifan$

再去merge试试

还是不行,所以再去添加忽略文件。

licrifandeMacBook-Pro:iOS-Client crifan$ vi .gitignore
licrifandeMacBook-Pro:iOS-Client crifan$ git status –ignored
On branch v1.0
Your branch is up-to-date with ‘origin/v1.0’.
Unmerged paths:
  (use "git reset HEAD <file>…" to unstage)
  (use "git add <file>…" to mark resolution)
both modified:   JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/UserInterfaceState.xcuserstate
Untracked files:
  (use "git add <file>…" to include in what will be committed)
.gitignore
Ignored files:
  (use "git add -f <file>…" to include in what will be committed)
JianDao/JianDao.xcodeproj/project.xcworkspace/xcuserdata/crifan.xcuserdatad/WorkspaceSettings.xcsettings
JianDao/JianDao.xcodeproj/xcuserdata/crifan.xcuserdatad/xcdebugger/
JianDao/JianDao/Assets.xcassets/.DS_Store
JianDao/JianDao/Assets.xcassets/AddPerson/.DS_Store
JianDao/JianDao/Assets.xcassets/Contact/.DS_Store
JianDao/JianDao/Assets.xcassets/Conversation/.DS_Store
JianDao/JianDao/Assets.xcassets/DropDownList/.DS_Store
JianDao/JianDao/Assets.xcassets/File/.DS_Store
JianDao/JianDao/Assets.xcassets/My/.DS_Store
no changes added to commit (use "git add" and/or "git commit -a")
licrifandeMacBook-Pro:iOS-Client crifan$

解决了:

[已解决]Xcode中改动的User Interface State到底是什么意思

再去添加其他的,一般会过滤不上传的文件:

xcode git 忽略user interface state文件 – 简书

最后暂时给.gitignore添加如下内容:

UserInterfaceState.xcuserstate
WorkspaceSettings.xcsettings
xcdebugger
*.xcbkptlist

转载请注明:在路上 » [已解决]git中的.gitignore文件

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.561 seconds, using 22.13MB memory