gitignore

What should be in my .gitignore for an Android Studio project?

寵の児 提交于 2019-11-26 03:14:37
问题 What files should be in my .gitignore for an Android Studio project? I\'ve seen several examples that all include .iml but IntelliJ docs say that .iml must be included in your source control. 回答1: Updated to Android Studio 3.0 Please share missing items in comments. A late answer but none of the answers here and here was right on the money for us... So, here's our gitignore file: #built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin

Whitelisting and subdirectories in Git

独自空忆成欢 提交于 2019-11-26 03:06:51
问题 I have created a white-list for text files only. * !*.txt Now, I have an untracked text file in a sub-directory - sub/dir/file.txt , and this is NOT shown (it is ignored). Text files in the root directory are shown, however. Why is that, and how do I fix it? 回答1: If you try it that way, it'll fail, because you'll end up blacklisting the directories in your structure. To solve, you want to blacklist everything that is not a directory, and is not one of the file-types you want to commit, while

How can I stop .gitignore from appearing in the list of untracked files?

雨燕双飞 提交于 2019-11-26 02:26:01
问题 I just did a git init on the root of my new project. Then I created a .gitignore file. Now, when I type git status , .gitignore file appears in the list of untracked files. Why is that? 回答1: The .gitignore file should be in your repository, so it should indeed be added and committed in, as git status suggests. It has to be a part of the repository tree, so that changes to it can be merged and so on. So, add it to your repository, it should not be gitignored. If you really want you can add

How to ignore certain files in Git

元气小坏坏 提交于 2019-11-26 02:23:15
I have a repository with a file, Hello.java . When I compile it, an additional Hello.class file is generated. I created an entry for Hello.class in a .gitignore file. However, the file still appears to be tracked. How can I make Git ignore Hello.class ? Ondrej Slinták The problem is that .gitignore ignores just files that weren't tracked before (by git add ). Run git reset name_of_file to unstage the file and keep it. In case you want to also remove the given file from the repository (after pushing), use git rm --cached name_of_file . How to ignore new files Globally Add the path(s) to your

Gitignore not working

无人久伴 提交于 2019-11-26 01:56:03
问题 My .gitignore file isn\'t working for some reason, and no amount of Googling has been able to fix it. Here is what I have: *.apk *.ap_ *.dex *.class **/bin/ **/gen/ .gradle/ build/ local.properties **/proguard/ *.log It\'s in the directory master , which is my git repo. I\'m running Git 1.8.4.2 because I\'m on a MacBook running OSX 10.8.6. 回答1: The files/folder in your version control will not just delete themselves just because you added them to the .gitignore . They are already in the

Using git, how do I ignore a file in one branch but have it committed in another branch?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 01:55:56
问题 I\'ve got a project that I\'m deploying to Heroku. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with). I\'d like to put the source code for it up on GitHub, but GitHub has a 300 MB limit on their free accounts. I don\'t want to use 50 MB of my limit on a bunch of mp3 files. Obviously, I could add them to the .gitignore file to keep them out of my repo. However, I deploy to Heroku using git push heroku . The mp3 files

How can I Remove .DS_Store files from a Git repository?

安稳与你 提交于 2019-11-26 01:55:13
问题 How can I remove those annoying Mac OS X .DS_Store files from a Git repository? 回答1: Remove existing files from the repository: find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch Add the line .DS_Store to the file .gitignore , which can be found at the top level of your repository (or created if it isn't there already). You can do this easily with this command in the top directory echo .DS_Store >> .gitignore Then git add .gitignore git commit -m '.DS_Store banished!' 回答2:

Explain which gitignore rule is ignoring my file

天大地大妈咪最大 提交于 2019-11-26 01:48:44
问题 Is there any way to see why some file is getting ignored by git (i.e. which rule in a .gitignore file is causing the file to be ignored)? Imagine I have this (or a much more complex scenario, with hundreds of folders and tens of .gitignore files: / -.gitignore -folder/ -.gitignore -subfolder/ -.gitignore -file.txt If I run git add folder/subfolder/file.txt git may complain of it being ignored: The following paths are ignored by one of your .gitignore files: folder/subfolder/file.txt Use -f if

Global Git ignore

好久不见. 提交于 2019-11-26 01:47:58
问题 I want to set up Git to globally ignore certain files. I have added a .gitignore file to my home directory ( /Users/me/ ) and I have added the following line to it: *.tmproj But it is not ignoring this type of files, any idea what I am doing wrong? 回答1: You need to set up your global core.excludesfile configuration file to point to this global ignore file. e.g. *nix or Windows git bash: git config --global core.excludesfile '~/.gitignore' Windows cmd: git config --global core.excludesfile "

How do I ignore files in a directory in Git?

心不动则不痛 提交于 2019-11-26 01:43:47
问题 What is the proper syntax for the .gitignore file to ignore files in a directory? Would it be config/databases.yml cache/* log/* data/sql/* lib/filter/base/* lib/form/base/* lib/model/map/* lib/model/om/* or /config/databases.yml /cache/* /log/* /data/sql/* /lib/filter/base/* /lib/form/base/* /lib/model/map/* /lib/model/om/* ? 回答1: PATTERN FORMAT A blank line matches no files, so it can serve as a separator for readability. A line starting with # serves as a comment. An optional prefix !