0

I have an ASP.NET MVC3 application. To get everything started, I created a new repo and pushed "all" my changes as the initial commit. This initial commit also contained all the debug files that were generated when I was creating / testing my project (before committing).

How do I add the debug files in my .gitignore file?

I want to ignore all changes in the following directories. This is also what I have in my .gitignore file

my_project/bin
my_project/obj
Farhan Ahmad
  • 5,148
  • 6
  • 40
  • 69

2 Answers2

2

You need to add the following two lines to .gitignore:

my_project/bin/
my_project/obj/

Plus you have to git rm -r both directories beforehand. If you want to keep them, but not change them later: you need to move them somewhere else, delete them with git rm -r, commit it and then place them again. Then, thanks to created .gitignore file, git won't track those directories anymore.

Edit:

Actually

my_project/bin
my_project/obj

should work too.

1

If you are using github, you can initialize your repository using CSharp .ignore like below:enter image description here

If not you can use a copy of it from CSharp ignore gist

It works well for all of my asp.net projects. It saved me from these types of issues.

Edit:

For the existing project or files you can follow the steps in this answer to apply the new git ignore.

Community
  • 1
  • 1
Yogiraj
  • 1,952
  • 17
  • 29