Tanya K.
Tanya K.

Reputation: 337

Visual Studio Marks Files as "ignored"?

I cloned an existing project on my local machine and opened it in VS and added a few classes after what they all became marked up as "ignored" with red icons with "minus" sign on them in the solutions view for the files.

When I tried to make a commit, none of the aformentioned marked files where pushed.

Adding them to the project did not resolve the issue. What is the reason for them to be listed as ignored and how to resolve??

Solutions View Showing ignored files

Upvotes: 22

Views: 35616

Answers (4)

basecamp
basecamp

Reputation: 131

Say the .gitignore file has this:

*.log

in it.

Now, a project that's named with a .Log suffix will not be committed(for example a project called CompanyName.Domain.Service.SubService.Log)

To add such a project to source control, you'd need to manually add it using:

git add <RootFolder>/<CompanyName.Domain.Service.SubService>.Log/* -f

This will force commit the change contrary to the opinion of the .gitignore file. However, this does not remove the .log from the .gitignore file. But once the force commit happens, the project is already in source control and will therefore not be subject to the .gitignore file. Thereafter, commits to this project will be committed.

Upvotes: 4

Kenneth Ray
Kenneth Ray

Reputation: 41

Not sure if this helps the @Tanya, and here's my partially similar experience.

And sadly (as a reflection on my powers of observation) it turned out to be exactly as @goamn had suggested.

I was building a new console app (very short list of files) to help me do a backup activity, and I had called the VS project “backup”.

What I missed (at first and second glance) was that in the .gitignore was the line (in the “Backup & report files” of all likely places!):

# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
Backup*

Merely removing this line from that file, even after I had (what appeared to me to be a horked) repository already set up and non functional in github, fixed it right up. I was able to commit the files with no problem.

Hope that helps.

Upvotes: 3

goamn
goamn

Reputation: 2126

They are (most likely) being ignored by .gitignore file.

If you can't see anything obvious (check substrings of the file name as well as extension), then look for these and remove them:

/* !/content/

Upvotes: 18

Chris Halcrow
Chris Halcrow

Reputation: 31950

You need to add first, ensure they're staged, commit, then push

Upvotes: -3

Related Questions