gitignore

git ignore all files except one extension and folder structure

筅森魡賤 提交于 2020-03-17 05:04:18
问题 This is my .gitignore: #ignore all kind of files * #except php files !*.php All I want is to ignore all kind of files except the .php ones, but with this .gitignore I'm also ignoring folders... Is there a way to tell git to accept my project folder structure while keeping the track only of the .php files? It seems like now I can't add folders to my repo: vivo@vivoPC:~/workspace/motor$ git add my_folder/ The following paths are ignored by one of your .gitignore files: my_folder Use -f if you

Git 的.gitignore 配置说明

一世执手 提交于 2020-02-29 03:11:31
.gitignore 配置文件用于配置不需要加入版本管理的文件,配置好该文件可以为我们的版本管理带来很大的便利,以下是个人对于配置 .gitignore 的一些心得。 1、配置语法:   以斜杠“/”开头表示目录;   以星号“*”通配多个字符;   以问号“?”通配单个字符   以方括号“[]”包含单个字符的匹配列表;   以叹号“!”表示不忽略(跟踪)匹配到的文件或目录;      此外,git 对于 .ignore 配置文件是按行从上到下进行规则匹配的,意味着如果前面的规则匹配的范围更大,则后面的规则将不会生效; 2、示例:   (1)规则:fd1/*      说明:忽略目录 fd1 下的全部内容;注意,不管是根目录下的 /fd1/ 目录,还是某个子目录 /child/fd1/ 目录,都会被忽略;   (2)规则:/fd1/*      说明:忽略根目录下的 /fd1/ 目录的全部内容;   (3)规则: /* !.gitignore !/fw/bin/ !/fw/sf/ 说明:忽略全部内容,但是不忽略 .gitignore 文件、根目录下的 /fw/bin/ 和 /fw/sf/ 目录; 以下是作者在阅读Open edX开源项目时读到的.gitignore的相关配置: # .gitignore for edx-platform. # There's a lot here,

Chinese characters in gitignore

落爺英雄遲暮 提交于 2020-02-08 09:32:39
问题 I am using git for bunch of my java projects. I want to ignore .classpath, bin, .gradle and bunch of other files and folders. I cannot access this files / folders in eclipse to ignore them from eclipse. Hence I decided to edit the .gitignore file. The file contains random chinese characters. I still went ahead and updated the .gitignore file with the required file list. However, when I ignore any other file from eclipse, the .gitignore is again appended with chinese characters. Is this

When would you use .git/info/exclude instead of ~/.gitignore (core.excludesFile) to exclude files?

本秂侑毒 提交于 2020-02-04 08:40:22
问题 I am little bit confused as to when would you use .git/info/exclude instead of ~/.gitignore (core.excludesFile) to exclude files? I am clear when to use .gitignore file present in project repository which is specific to that project, version-controlled and shared with other repo via clone but I am unable to understand difference between the above two somewhat user specific files to be ignored. Thus, I am looking for difference between ~/.gitignore and .git/info/exclude and not between

Should we ignore misc.xml and <projectFolderName>.iml in Pycharm .idea/ folder?

China☆狼群 提交于 2020-02-02 02:07:10
问题 My google search give me this thread which leads us to Pycharm official site here saying that we should KEEP all except workspace.xml , tasks.xml Though I see that files misc.xml and <projectFolderName>.iml also contains local/physical path pointing to a sub folder in my user home in Ubuntu. So I confused and brought it up here - should we git ignore those two files too? 回答1: 1) <projectFolderName>.iml - By default Idea editors produce <projectFolderName>.iml files which are place specific.

How to ignore existing, committed files in git? [duplicate]

此生再无相见时 提交于 2020-01-23 06:25:46
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: GIT: Ignoring Version-Controlled Files There are plenty of answers around .gitignore on Stackoverflow, still I haven't found an answer: I have an existing git project, with a readme.md and a sample_folder/ , both on top-level. I do want to remove these from my git(hub) repository in general. But I would like to ignore them, that is, preventing them to be pulled at all, in a certain cloned local repository, i.e.

GitIgnore - Ignoring bin/ but including bin/*.refresh

爱⌒轻易说出口 提交于 2020-01-22 17:41:08
问题 I'm trying to ignore the bin folder of a web project, but include the .refresh files that are in that bin folder. Here's what I have in my .gitignore: [Bb]in/ #Allow .refresh files for web sites ![Bb]in/*.refresh But this isn't working. What am I doing wrong? I've also tried: !*.refresh With the same results. Update: Here's the file structure if that helps diagnose this: \rootfolder .gitignore \project1 \bin file1.dll file1.dll.refresh You can see where our gitignore file is located. We don't

Difference between .gitignore rules with and without trailing slash like /dir and /dir/

浪尽此生 提交于 2020-01-22 04:25:55
问题 Is there a difference between /dir and /dir/ in the .gitignore file within a Git repository? How are the following different? /dir /dir/ /dir/* 回答1: Please see Victor Schröder's answer below. 回答2: This is a old question, but high ranked on Google and the top voted answer is wrong . Here goes the correct answer. Yes, these rules are different. /dir will match a file, directory, link, anything named dir /dir/ will match only a directory named dir /dir/* will match all files, directories and

Difference between .gitignore rules with and without trailing slash like /dir and /dir/

元气小坏坏 提交于 2020-01-22 04:25:47
问题 Is there a difference between /dir and /dir/ in the .gitignore file within a Git repository? How are the following different? /dir /dir/ /dir/* 回答1: Please see Victor Schröder's answer below. 回答2: This is a old question, but high ranked on Google and the top voted answer is wrong . Here goes the correct answer. Yes, these rules are different. /dir will match a file, directory, link, anything named dir /dir/ will match only a directory named dir /dir/* will match all files, directories and

create-react-app git pushing node_modules

不羁的心 提交于 2020-01-16 09:07:42
问题 So I am trying to push my initial commit using the create-react-app from a local git build. My .gitignore looks like such: # See https://help.github.com/ignore-files/ for more about ignoring files. # dependencies /node_modules # testing /coverage # production # misc .DS_Store .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log* And my directory looks like this: Left the directory structure the same by default, so why is it