Unhandled Exception
Unhandled Exception

Reputation: 1513

Git : Removing .gitignore file doesn't seem to have any affect

Working in an existing directory that the only file is the .gitignore which looks like this :

# Ignore everything in this directory
*
# Except this file
!.gitignore

After adding 2 new files and doing a "git status", the 2 new files don't appear due to the .gitignore file.

I figure the .gitignore needs to be removed. To do this, the following command was executed.

> git rm -f .gitignore

Doing a "git status", the 2 new files still don't appear.

Even tried this command afterward, but still the 2 new files don't appear with the git status" command.

> git add .gitignore

I have since tried to do a reset and all but that generated other issues. Even deleting the branch and recreating it didn't help. Eventually I had to do a "git reset --hard". This brought back the .gitignore file and my other files I created are still there. Essentially I am back to square 1.

What commands need to be executed so that a "git status" will show the newly created files?

Upvotes: 1

Views: 137

Answers (1)

torek
torek

Reputation: 489748

Run:

git check-ignore -v

on the various files that Git is continuing not to complain-about, so as to see which other control file is telling Git don't complain about these files.

If that produces nothing, use git ls-files -v to look for index entries whose flag is either h or S, indicating that a file is marked assume-unchanged or skip-worktree, or s (both flags set). It might also be worth checking with -f for "fsmonitor valid" flags in case there is a bug in that code.

Upvotes: 2

Related Questions