Dear Git, Stop Tracking My Bin Folders

Visual Studio 2013 was the first version to come pre-packaged with Git. When you create a new solution and elect Git as source control, it kindly places a new .gitignore file in your solution root folder. This tells Git to ignore a bunch of different files that you don’t want it tracking, including the bin and obj folders.

Any Visual Studio version prior to 2013 does not do this for you. So when I created a new solution in VS 2012 and used Git as source control manually through the command line, Git kept tracking all of the bin and obj folders. I ended up pushing a bunch of unnecessary files with every update. A trivial issue, but super annoying. Here’s how to fix it:

  1. Copy the .gitignore file from another solution that uses Visual Studio 2013 or higher, or copy the text from GitHub.
  2. Paste the file into your solution root folder, or, if you copied from GitHub, use the command line to create a new .gitignore file in your solution root and append the text to it.
  3. Finally, enter the following commands. This will reset your repo and tell Git to start ignoring the files in .gitignore.
git rm --cached -r .
git add .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s