Mark
Mark

Reputation: 6464

gitignore doesn't ignore files in repository

I have defined the following .gitignore:

/aclocal.m4
/config.guess
/config.sub

However after reconfiguration and rebuild, git status still reports:

# On branch master
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   aclocal.m4
#       modified:   config.guess
#       modified:   config.sub
...

I'm expecting it to say something like:

#       deleted:    aclocal.m4
...

What am I doing wrong here?

Upvotes: 3

Views: 4880

Answers (2)

Holloway
Holloway

Reputation: 7367

You are referring to files at root of the filesystem not in your repository.

You need something like

aclocal.m4
config.guess
config.sub

If they have previously added them to the repository, you will also need to remove them (eg git rm aclocal.m4).

Upvotes: 4

Oin
Oin

Reputation: 7529

It sounds like those files are already being tracked by git. In that case you will first have to remove them from git (e.g. git rm filename). Then they will be ignored.

Upvotes: 7

Related Questions