git 添加.gitingnore 添加约束规则

转载自简书http://www.jianshu.com/p/9e285fe92d67

如果你看不到.git目录,你需要让隐藏的文件可见。具体做法就是打开一个Terminal窗口,输入以下命令:

1.defaults write com.apple.finder AppleShowAllFiles TRU

2.重启Finder

3.打开终端 切换到你的项目目录下 删除本地的UserInterfaceState.xcuserstate缓存

git 添加.gitingnore 添加约束规则_第1张图片

(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)

git 添加.gitingnore 添加约束规则_第2张图片

(2)

git 添加.gitingnore 添加约束规则_第3张图片

(3)

git 添加.gitingnore 添加约束规则_第4张图片

(4)

git 添加.gitingnore 添加约束规则_第5张图片

(5)

git 添加.gitingnore 添加约束规则_第6张图片

直接 在终端cd  拖拽Sunny.xcuserdatad到终端  然后就可以执行命令了

4.在同 .git目录下创建.gitignore文件。

git 添加.gitingnore 添加约束规则_第7张图片

(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


你可能感兴趣的:(git 添加.gitingnore 添加约束规则)