使用Git如何優雅的忽略掉一些不必的文件


熟悉使用Git之后發現,使用sourceTree來管理和開發項目會變得更高效,現在我用bitbucket管理自己的項目,它提供了私有的倉庫,用起來還是比較爽,不過剛開始用的時候,只要一打開本地倉庫的工程,就會修改一個緩沖文件,然后在sourceTree很不智能的提示項目改動,無奈右鍵ignore文件,但是后來發現這樣太不優雅了,每次工程都要右鍵N多個文件,尋思着一定會有優雅的方式解決..於是各種折騰...最后找到解決辦法了.

第一步要找到一個 .gitignore_global 的配置文件,在~/ 目錄下使用ls -all就能找這個文件,然后vi .gitignore_global打開它,把下面的代碼添加進去,然后wq退項目.

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/

 

如果在~/目錄下沒有發現這個文件.gitignore_global,詳情看這個鏈接:https://help.github.com/articles/ignoring-files/

Github忽略文件原文地址:https://github.com/github/gitignore/blob/master/Objective-C.gitignore

所有開發環境下的gitignore:https://github.com/github/gitignore

這里有解釋忽略文件的用於:https://gist.github.com/adamgit/3786883

這里還有一些人提問題的中文網站:http://segmentfault.com/q/1010000000257971


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM