gitignore

Where does the .gitignore file belong?

◇◆丶佛笑我妖孽 提交于 2019-11-27 19:41:17
问题 Does the .gitignore file belong in the .git folder structure somewhere or in the main source files? 回答1: Put .gitignore in the working directory. It doesn't work if you put it in the .git (repository) directory. $ ls -1d .git* .git .gitignore 回答2: As the other answers stated, you can place .gitignore within any directory in a Git repository. However, if you need to have a private version of .gitignore , you can add the rules to .git/info/exclude file. 回答3: You can place .gitignore in any

Unignore subdirectories of ignored directories in Git

99封情书 提交于 2019-11-27 18:54:38
Let's say I have ignored a directory, but I want to unignore specific subdirectories therein. So I have the setup: /uploads/ /uploads/rubbish/ /uploads/rubbish/stuff/KEEP_ME/ /uploads/foo/ /uploads/foo/bar/lose/ And I want to ignore everything but the KEEP_ME directory. I would hope the ignore would look something like: /uploads/* !/uploads/rubbish/stuff/KEEP_ME/ But that's not working, and neither are several permutations on the same theme. One that does work is /uploads/**/**/**/ !/uploads/rubbish/stuff/KEEP_ME/ But that feels a little restrictive and verbose? Art Shayderov According to

Git ignore all except subfolder

爷,独闯天下 提交于 2019-11-27 18:20:53
问题 I searched through other questions but can't find a working solution for my project. Having a Magento project, I want to exclude everything except this: /app/design/frontend/default/theme_name # and obviously all subfolders /skin/frontend/default/theme_name # and all subfolders I've tried a lot of combinations but without luck. Currently I'm stuck with this .gitignore file: * !/app/ !/app/* app/* !/app/design/ !/app/design/* But it doesn't work recursively below the design folder. It only

Ignoring a directory from a Git repo after it's been added

早过忘川 提交于 2019-11-27 18:17:03
I've learned how to exclude an entire directory in git (add a line bin/ to .gitignore ). And I've learned how to ignore files "after the fact" (i.e. after they have been added to git): git rm --cached <filename> How do I ignore an entire directory (e.g. bin/ ) after it has been added to a Git repo? I tried git rm --cached bin/ but all I received was the error: fatal: pathspec 'bin/' did not match any files When I tried (at the root directory, where .git exists) git rm --cached MyProj/bin/ the error is different: fatal: not removing 'MyProj/bin/' recursively without -r What does this mean and

git: have different .gitignore file for each remote

天涯浪子 提交于 2019-11-27 18:15:56
I have a remote repo in which I want to commit certain files (the compiled files to deploy them on a cloud computing platform), but I don't want to deploy them on github... is there some way to have to different .gitignore files, one for each remote? This doesn't really make sense in git's model. Commits contain sets of files; all .gitignore files do is tell the UI not to automatically add files matching certain patterns. What this would effectively mean is to have parallel sets of commits that are almost the same, but containing only a subset of the files. It'd be possible to do this with a

Correctly ignore all files recursively under a specific folder except for a specific file type

北城以北 提交于 2019-11-27 17:56:08
I have seen similar questions ( 1 , 2 and 3 ), but I don't get a proper solution from them. I need to ignore all files under a particular folder except for a specific file type. The folder is a subdirectory for the root path. Let me name the folder Resources . Since I don't want to complicate things, let me ignore files under all folders named Resources wherever it is. This is the most common solution (in all the duplicate questions) # Ignore everything * # Don't ignore directories, so we can recurse into them !*/ # Don't ignore .gitignore !.gitignore # Now exclude our type !*.foo The problem

gitignore directory exception not working

时光怂恿深爱的人放手 提交于 2019-11-27 17:47:27
问题 I have the following folder structure: public media catalog product category private tmp var test I want to gitignore everything in the media directory except for catalog/category and private My gitignore I am trying is: public/media/* !public/media/catalog/category/ !public/media/private But it doesn't work. Any new files added to the category or private directories are not available to add. I could just git add force but I would like this done through the gitignore if possible 回答1: It's

.gitignore files added inside Git submodules

淺唱寂寞╮ 提交于 2019-11-27 17:26:22
I recently reorganized my dotfiles to live inside a Git repository at ~/Dropbox/dotfiles and I'm using pathogen to bundle all Vim addons inside ~/Dropbox/dotfiles/home/.vim/bundle . These addons were added as Git submodules. Now the problem is, when I run Vim, it automatically generates the documentation for all addons and puts them inside each submodule directory. This adds untracked content to the submodules, which I'd like to avoid. ruby-1.8.7-p330@gs ~/Dropbox/dotfiles ‹master*› $ git st # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be

When would you use .git/info/exclude instead of .gitignore to exclude files?

∥☆過路亽.° 提交于 2019-11-27 17:16:26
I am a bit confused about the pros and cons of using .git/info/exclude and .gitignore to exclude files. Both of them are at the level of the repository/project, so how do they differ and when should we use .git/info/exclude ? mu 無 The advantage of .gitignore is that it can be checked into the repository itself, unlike .git/info/exclude . Another advantage is that you can have multiple .gitignore files, one inside each directory/subdirectory for directory specific ignore rules, unlike .git/info/exclude . So, .gitignore is available across all clones of the repository. Therefore, in large teams

Typical .gitignore file for an Android app

这一生的挚爱 提交于 2019-11-27 16:46:26
Just put an Android project under git ( beanstalk ) version control via the command line ( mac terminal ). Next step is to set up exclusions. To those of you who have already been down this path: What should a typical .gitignore file look like for an android project? Project set up in Eclipse You can mix Android.gitignore : # 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 with Eclipse.gitignore : *.pydevproject .project .metadata bin/** tmp/** tmp/**/* *.tmp *