gitignore

Git-ignore certain files in sub-directories, but not all

风格不统一 提交于 2019-11-28 23:31:35
问题 I have a structure similar to the following: /root/ /root/data/ /root/data/script.php /root/data/some.json /root/data/feature/one.json /root/data/feature/two.json /root/data/other-feature/one.json /root/data/other-feature/important-script.php I'd like git to ignore any .json files under the '/data/...' path, but '/data/' sometimes contains sub-directories. My understanding is that a simple data/*.json in gitignore will only match one directory, as the * doesn't match / , as stated at http:/

gitignore ignore files within a folder that has whitespace in the middle

会有一股神秘感。 提交于 2019-11-28 22:14:16
I have a folder that have a space in the middle, but have a webconfig file inside it. I want git to ignore the webconfig file but somehow it's not ignoring it because of the space in the folder. Anybody know how to work around this? My FolderName/Web.config I tried to insert the %20 in the middle but that did not help. Thank you for your help. ch3ka Try My\ FolderName/Web.config or "My FolderName/Web.config" I'm guessing you probably have to use "My FolderName"/Web.config instead. 来源: https://stackoverflow.com/questions/10213653/gitignore-ignore-files-within-a-folder-that-has-whitespace-in-the

Added pod files and pushed. How to undo? how to use gitignore in Xcode & github?

元气小坏坏 提交于 2019-11-28 21:25:57
This is a two part question: 1) I have added committed and pushed all pod files to github. Is there a way I can remove them and not push them again to github? 2) I know gitignore can help, but I don't know how to use it. Can anyone please walk me through the process of using gitignore? so I think what I can do is, get the project from github, add gitignore, and then push again. is that correct? Please help, new to github & Xcode. That's correct, you need to add the Pods directory to your .gitignore 1) Remove your files from your github repository: git rm -r Pods/ and don't forget to commit and

Is there a way to setup remote-specific .gitignores?

断了今生、忘了曾经 提交于 2019-11-28 21:12:46
Is there a simple way to setup different .gitignore files for different remotes? I have a repository I push up to both Heroku and Github. I need database.yml for Heroku, but don't want some of the information to be pushed up to Github. So I need a different .gitignore file for each of the remotes. I tried having two separate branches, one that ignores database.yml, and one that doesn't. The problem is that when I checkout the heroku branch and go back into my github branch, the entire database.yml file is gone. Any tips? I don't know anything about the requirements for Heroku - hopefully

gitignore - only allow certain extensions and files

二次信任 提交于 2019-11-28 21:12:06
not sure why this isn't working, as I've done this loads! Maybe I'm having a bad day... I'm using the following code to ignore all files except for certain filenames and extension * !.gitattributes !.gitignore !readme.md !.gitkeep !*.php For some reason, its only allowing me to commit the .gitignore and readme.md, even though I have php files in subfolders etc. Is there anything wrong with it? Just fyi, I'm using "git add -A" to pick up the files to commit. Thanks in advance! The solution is to tell Git not to ignore sub directories : * !.gitattributes !.gitignore !readme.md !.gitkeep !*.php !

What is the 'standard' content of .gitignore for an iPhone (Xcode) project?

微笑、不失礼 提交于 2019-11-28 20:25:16
What is considered the 'standard' content of .gitignore file for an iPhone (Xcode) project? PS: not sure if this needs to be a CW. build/ .DS_Store **/*.pbxuser *.mode2v3 *.mode1v3 **/*.perspectivev* This is a good start. updated with Dave's suggestions. You should also exclude xcworkspace and xcuserdata in xcode 4.2. So here is a complete list which one should ignore for iOS projects # Exclude the build directory build/* # Exclude temp nibs and swap files *~.nib *.swp # Exclude OS X folder attributes .DS_Store # Exclude user-specific XCode 3 and 4 files *.mode1 *.mode1v3 *.mode2v3 *

.gitignore whitelist on directory and its contents

和自甴很熟 提交于 2019-11-28 18:38:25
I'm trying to whitelist the directory (and its contents) SupplierName in my Zend Framework 2 vendor directory. The original .gitignore file in /vendor looks like this: # Add here the vendor path to be whitelisted # Ex: for composer directory write here "!composer" (without quotes) !.gitignore * Now I'd like to whitelist the directory SupplierName which shouldn't be too hard I thought. I have read the docs on gitignore and tried the following configurations: First try , add !SupplierName right after the comment which says that I have to add the whitelisted path here. # Add here the vendor path

Github Pls Forget Me —— .gitignore详解

蓝咒 提交于 2019-11-28 18:14:04
忽略某些文件 一般我们总会有些文件无需纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表。通常都是些自动生成的文件,比如日志文件,或者编译过程中创建的临时文件等。我们可以创建一个名为 .gitignore 的文件,列出要忽略的文件模式。来看一个实际的例子: $ cat .gitignore *.[oa] *~ 第一行告诉 Git 忽略所有以 .o 或 .a 结尾的文件。一般这类对象文件和存档文件都是编译过程中出现的,我们用不着跟踪它们的版本。第二行告诉 Git 忽略所有以波浪符(~)结尾的文件,许多文本编辑软件(比如 Emacs)都用这样的文件名保存副本。此外,你可能还需要忽略 log,tmp 或者 pid 目录,以及自动生成的文档等等。要养成一开始就设置好 .gitignore 文件的习惯,以免将来误提交这类无用的文件。 文件 .gitignore 的格式规范如下: 所有空行或者以注释符号 # 开头的行都会被 Git 忽略。 可以使用标准的 glob 模式匹配。 匹配模式最后跟反斜杠(/)说明要忽略的是目录。 要忽略指定模式以外的文件或目录,可以在模式前加上惊叹号(!)取反。 所谓的 glob 模式是指 shell 所使用的简化了的正则表达式。星号(*)匹配零个或多个任意字符;[abc] 匹配任何一个列在方括号中的字符(这个例子要么匹配一个 a,要么匹配一个 b

Trouble un-ignoring previously ignored files in Git repo

六眼飞鱼酱① 提交于 2019-11-28 18:05:39
I have a site that has a /sites/default/files/ directory where user content is typically kept. Figuring that I don't need to be tracking this stuff, I added /sites/default/files/ to my .gitignore file. Then I discovered that I also wanted to keep some mostly-permanent uploads in that directory as well. Now it makes more sense to track everything in /sites/default/files/ and exclude undesirable subdirectories, instead of doing it the other way around. The problem is that Git won't stop ignoring that directory. I have removed the lines from .gitignore that specify this directory and it won't

How to .gitignore files recursively

一世执手 提交于 2019-11-28 18:04:51
I'm trying to avoid the following pattern in my .gitignore file. MyPrject/WebApp/Scripts/special/*.js MyPrject/WebApp/Scripts/special/*/*.js MyPrject/WebApp/Scripts/special/*/*/*.js MyPrject/WebApp/Scripts/special/*/*/*/*.js MyPrject/WebApp/Scripts/special/*/*/*/*/*.js MyPrject/WebApp/Scripts/special/*/*/*/*/*/*.js MyPrject/WebApp/Scripts/special/*/*/*/*/*/*/*.js We tried: MyPrject/WebApp/Scripts/special/**.js MyPrject/WebApp/Scripts/special/**/*.js This however didn't work. This is git on Windows. Is there a more concise way to do this without repeating things? Sam As of git 1.8.2, this: