Gitignore
2013-04-18 00:00
148 查看
Fortunately GIT has a very easy solution for this, just run the following command on the file or path you want to ignore the changes of: git update-index --assume-unchanged <file> # built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties # Eclipse project files .classpath .project # Proguard folder generated by Eclipse proguard/ # Intellij project files *.iml *.ipr *.iws .idea/ https://github.com/github/gitignore/blob/master/Android.gitignore Here’s a basic.gitignore:$ cat .gitignore # Can ignore specific files .DS_Store # Use wildcards as well *~ *.swp # Can also ignore all directories and files in a directory. tmp/**/*
Of course, this could get a lot more complex. You can also add exceptions to ignore rules by starting the line with!. See an example of this at the GitHub guide on ignores.
Two things to keep in mind with ignoring files: First, if a file is already being tracked by Git, adding the file to.gitignorewon’t stop Git from tracking it. You’ll need to dogit rm --cached <file>to keep the file in your tree and then ignore it. Secondly, empty directories do not get tracked by Git. If you want them to be tracked, they need to have something in them. Usually doing atouch .gitignoreis enough to keep the folder tracked.
You can also open up$GIT_DIR/info/exclude($GIT_DIRis usually your.gitfolder) and edit that file for project-only ignores. The problem with this is that those changes aren’t checked in, so use this only if you have some personal files that don’t need to be shared with others on the same project.
Your final option with ignoring folders is adding a per-user ignore by setting up acore.excludesfilesoption in your config file. You can set up a.gitignorefile in your HOME directory that will affect all of your repositories by running this command:
git config --global core.excludesfile ~/.gitignore
相关文章推荐
- 【转】.gitignore规则总结
- Git中.gitignore文件不起作用的解决以及Git中的忽略规则介绍
- Git Windows version default option false(core.ignorecase is true)
- .gitignore 忽略文件 (忽略pods文件)需要进入podfile文件所在目录执行 pod install
- iOS备忘录之编辑.gitignore 后不起作用
- .gitignore文件配置
- gitignore
- cocos2d-x的gitignore配置
- Git让gitignore生效
- GIT有时候.gitignore不起作用的问题
- gitignore完整使用方法
- 如何创建.gitignore文件
- gitignore忽略不生效及git 中 gitignore使用
- Git之忽略文件(ignore file)
- iOS-Main-(RAC演练)-创建项目cocoapod和gitignore的细节
- Idea自带的文件过滤功能,功能类似gitignore不过只能过滤文件夹
- ,gitignore 中规则不起作用的原因
- 在 git 中忽略文件 gitignore 与 exclude
- 【GitHub】GitHub .gitignore文件简单配置使用
- 通用版gitignore