felix001
felix001

Reputation: 16691

Git is incorrectly ignoring files

I have a repo that has the following folders,

/test/
/input/
/misc/
/app/

I want to exclude all files other then the directories test, input and misc. Ive added a file .git/info/exclude which contains

/*
!/test/*
!/input/*
!/misc/*

However when I perform a 'git add *' I get the following.,

[root@server folder]# git add *
The following paths are ignored by one of your .gitignore files:
__init__.py
__init__.pyc
test
input
misc
app

Ive checked the ignore file via the command

[root@server folder]#  git config core.excludesfile
.git/info/exclude

Any ideas ?

Upvotes: 1

Views: 282

Answers (2)

Richard Hansen
Richard Hansen

Reputation: 54163

What version of Git are you using? I am unable to reproduce the problem with Git v1.9.2.

The following script:

mkdir -p /tmp/repo /tmp/repo/foo /tmp/repo/bar
cd /tmp/repo
git init .
cat <<EOF >.git/info/exclude
/*
!/foo/
EOF
echo blah | tee foo/blah | tee bar/blah >blah
git add *

produces the following output:

The following paths are ignored by one of your .gitignore files:
bar
blah
Use -f if you really want to add them.
fatal: no files added

Note that foo is not listed in the output.

Upvotes: 0

ferpega
ferpega

Reputation: 3224

Try this entries on .git/info/exclude file:

/*
!test/
!input/
!misc/

Upvotes: 1

Related Questions