Why a .gitignore file?
By default Git will monitor all the files inside your folders. So this means that even bin and obj folders and (if you are using Resharper, your _ReSharper files) are listed to be added to your repository. I don’t think you want to include these files inside your source control system(at least I don’t).
Creating the .gitignore file in Windows
I’m not a commandline guru, so I tried creating this file the easy way. I created a new text file inside my repository folder and tried to rename it to .gitignore. Unfortunately no success:
It seems that Windows doesn’t understand dot files (and Git uses this a lot; .bashrc, .gitignore, etc…). Windows expects your files to have a name.extension convention.
So back to the Gitbash console… but no .gitignore. Type “touch .gitignore”. This will create the .gitignore file with no content.
Adding the .gitignore content to support .NET development
So now we have our .gitignore file, but it is still empty. What information should I add? Depending on the kind of development you’re doing(.NET, Java, Ruby), you probably want to add different data. Don’t loose time searching for this data yourself, instead go to https://github.com/github/gitignore and pick the content that suites your needs:
I’m going for the CSharp.gitignore file. Copy the content to your clipboard and open the .gitignore file in your favorite text editor (i.e., notepad, wordpad, notepad++, etc). Paste the CSharp.gitignore content and you are good to go!