I'm using Visual Studio 2013 Express using Git on a project.
I created my repository and copied the project files into it from another directory. I then checked my .gitignore
and .gitattributes
files. .gitignore
was pre-configured and looked to cover everything I needed to ignore for commits at this point.
I selected the Changes tab in Visual Studio under the "Team Explorer" tab and saw all my files were untracked, as expected. I then clicked "Add All". I assumed VS would only add files not matching those in my .gitignore
to the "Included Changes" list. Instead, all the files were added to the "Included Changes" list.
I then thought that maybe the .gitignore
file would be used when committing and that only files not matching those in .gitignore
would be committed. So I added a commit message and clicked "Commit".
When I select "View History" from the "Actions" drop down in the "Changes" tab I am presented with a pane to the left of my "Team Explorer" view that shows all the commits I've made. There is only 1 commit. When I double click that commit, the "Team Explorer" tab displays Commit 8db34b1c
and all the files in my project are listed there in the tree view with [add] after their name.
For example, App_Data/Movies.mdf
and App_Data/Movies.ldf
are listed even though my .gitignore
includes the lines
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
I don't understand how the .gitignore file is being used here or what the "Included Changes", "Excluded Changes" or "Untracked Files" sections mean.
An explanation of the above behavior and sections would be appreciated.
Edit--
I deleted my .git directory, created a new repo, copied my project files in again and then took screenshots of what I see.
Here are images of my .gitignore file and my "Changes" tab.
There's this SO question and this msdn question which shows that other people seem to be having issues as well. I tried deleting the .xml file added by VS in my .git directory (as noted in the msdn question) but that did not solve the issue for me.
Edit 2 --
This is my current directory structure :
/MvcMovie/
|--.git/
|
|---MvcMovie/
| |--App_Data/
| | |--Movies.mdf
| | |--Movies.ldf
| |
| |--App_Start/
| |--etc...
|
|--packages/
|--.gitignore
|--.gitattributes
|--MvcMovie.sln
|MvcMovie.v12.suo