gitignore

How to know which part of .gitignore that is actually responsible for ignoring some file?

你。 提交于 2019-12-06 07:46:01
Say I have .gitignore : x64/ x86/ bin/ obj/ FileA FileB FileC etc.. Now when I build, all build files that I want to ignore, are actually being ignored. However, the build fails for a missing file (Call it FileX). When I add FileX to the project, it builds fine with no errors. However, GIT does not see that I added that file, and when I do git status --ignored , I see the file under untracked files . I tried the solution in undo git assume unchanged with no success. Why this file is being ignored and I did not add it to .gitignore? To make sure why this file is being ignored, type: git check

gitignore all except file in sub-sub folder

白昼怎懂夜的黑 提交于 2019-12-06 07:28:06
问题 I already tried many combinations of the .gitignore but none worked for what I need. I have this tree: jobs/ jobs/projecta/config.xml jobs/projecta/garbage jobs/projecta/more/garbage jobs/projectb/config.xml jobs/projectb/garbage jobs/projectb/more/garbage Garbage means any other file. I want to commit only the config.xml files, and ignore everything inside jobs/ except them. So I tried: /jobs/* !/jobs/*/config.xml This way, everything inside jobs are ignored, including the config.xml file.

PHP filtering files and paths according .gitignore

只谈情不闲聊 提交于 2019-12-06 05:50:10
问题 I want to use PHP to read all files and paths ignored by .gitignore configuration. Just like how git does. It's possible to read directory repeatedly and use regular expression for each file to filter. But it`s so ineffective if the path have too much files. Any good and most effective way to read target files and path ignored by .gitignore? 回答1: You need to proceed in several steps: 1 - Find the .gitignore files Each folder can have one, so don't assume there's a single one. And submodules

Recursively ignore all files inside a specific directory except .json files

£可爱£侵袭症+ 提交于 2019-12-06 05:17:31
I have a file structure similar to the one below: foo/bar.foo node_modules/foo/bar.json node_modules/foo/bar/foo.bar What I want to do is ignore all the files inside the node_modules folder except the json files so that I end up with the following file structure in my repo: foo/bar.foo node_modules/foo/bar.json I tried to find a simple way to do that but I'm not quite there yet. Here's what I came up with in my .gitignore : # ignore everything inside node_modules node_modules/* # But descend into directories !node_modules/**/*.json What's the most elegant way to achieve the desired result? P.S

Can git filter out certain lines before commit?

我只是一个虾纸丫 提交于 2019-12-05 23:10:05
I have a repo on github that I am working out of and I often have comments on my .py files that starts with the " # TODO: " to keep a personal note of things to be done. # TODO: do this <code> I obviously do not want that to go in a commit. I want GitHub to search all the files when I am about to commit them and not include lines that start with # TODO: Does Git already do this? I know certain version control like perforce already have this feature. Any thoughts? VonC I want GitHub to search all the files when I am about to commit them and not include lines that start with # TODO: GitHub

Limit depth of .gitignore

▼魔方 西西 提交于 2019-12-05 19:55:43
For various reasons, I have the entry in my .gitignore in the root of a project: *.c As I desire, this ignores all C files from being included. However, I really only want the C files to only be ignored in the root directory, and not all the sub-directories: foo.c bar.c folder/baz.c In the above scheme, I only want foo.c and bar.c ignored. I do not want this gitignore rule to work recursively. How do I do this? I'm aware of being able to negate the rule with !*.c , but I'd rather not do that for every subdirectory. (This is what I am currently doing). You want to do this: /*.c I was looking

Make Git rebuild history using the current .gitignore

不羁岁月 提交于 2019-12-05 12:45:21
I did not use .gitignore to ignore files such as compiled binaries in my project, so these compiled binaries have been committed into the Git repository. And now I add .gitignore to my project. I want to rebuild the whole Git repo ignoring the files listed in .gitignore without losing any history. How can I do that? Remove those binary from the current cache if they were just added. git rm --cached abinary Then your .gitignore will automatically ignores those binaries. But if they were committed in past commits, You won't loose history, but you still need to remove those binaries from said

Git ignore changes to committed file

心已入冬 提交于 2019-12-05 10:15:04
I have a config file in my repo that shouldn't get changes committed to it. The problem is that, when I make changes to the file they are picked up by git status. I've tried various ways to ignore changes to it. How can it be automatically ignored when I clone the repo, so that any changes I make to the file shouldn't be picked up by git? Solutions I've tried: Adding the file to .gitignore . Doesn't seem to work. Is this because the file is already on the index? Using git update-index --assume-unchanged path/to/file . Seemed to work some what but is only local to my cloned repo. Others who

Git clean inside ignored folders

£可爱£侵袭症+ 提交于 2019-12-05 08:48:58
I have a folder foo that is included in gitignore: - .gitignore (this contains 'foo') - foo * *** bar When I run git clean -f or git clean -f -x , this does not delete bar (bar is a normal file). Is there a way to tell git to clean inside ignored folders? git clean -fdx will delete all untracked files, including directories. The -d is necessary to cause the cleaner to descend into the untracked dir. 来源: https://stackoverflow.com/questions/9314190/git-clean-inside-ignored-folders

Netbeans and Git, .obj files ignored

坚强是说给别人听的谎言 提交于 2019-12-05 07:18:55
I am working on a small git project involving .obj files. When I look at the "project tab" I see they are ignored But I cant understand why, if I look at my .gitignore: /DepthPeeling/nbproject/private/ /DepthPeeling/dist/ /DepthPeeling/build/ It looks fine If I open a Git Bash and type $ git add dragon.obj The following paths are ignored by one of your .gitignore files: DepthPelling/sry/depthPeeling/data/dragon.ogj Use -f if you really want to add them. fatal: no file added Wut? Might it be there is more than one .gitignore file? If I look for them, I find only the one in the root directory of