Ignoring directories in Git repositories on Windows

How can I ignore directories or folders in Git using msysgit on Windows?


Solution 1:

Create a file named .gitignore in your project's directory. Ignore directories by entering the directory name into the file (with a slash appended):

dir_to_ignore/

More information is here.

Solution 2:

By default, Windows Explorer will display .gitignore when in fact the file name is .gitignore.txt.

Git will not use .gitignore.txt

And you can't rename the file to .gitignore, because Windows Explorer thinks it's a file of type gitignore without a name.

Non command line solution:

You can rename a file to ".gitignore.", and it will create ".gitignore"