使用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

你可能感兴趣的:(git)