Git使用過程中ignore的一些使用問題

關(guān)于Git的使用過程中的一些不必要的文件的提交

作者:邵雄華

第一種方法

1.cd到工程目錄

cd /Users/shaoxionghua/ios/test

2.status一下

git status
(ps:會出現(xiàn)一下類似的東西)

  On branch develop
Your branch is up-to-date with 'origin/develop'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
    modified:   .DS_Store
    modified:   Live.xcworkspace/xcuserdata/shaoxionghua.xcuserdatad/UserInterfaceState.xcuserstate
no changes added to commit (use "git add" and/or "git commit -a")

3.rm這些不需要的文件或者路徑

git rm --cached .DS_Store
git rm --cached Live.xcworkspace/xcuserdata/shaoxionghua.xcuserdatad/UserInterfaceState.xcuserstate

4.提交這些變更

git commit -m 'ignore'

5.最好執(zhí)行一下pull和push

git pull
git push

第二種方法

1.cd到工程目錄

cd /Users/shaoxionghua/ios/test

2.修改.gitignore文件

一般常見的一些設置如下:
(ps:在.gitignore文件里面寫入如下內(nèi)容,不要問我這個文件在哪里,不要問我怎么打開它,方法請自行百度或者google)

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

3.提交修改gitignore文件

git rm -r --cached .
git add .
git commit -m 'update .gitignore'

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容