Create a Git Ignore File on Windows Vista

by Bill Beckelman 18. July 2009 20:00

I have been learning how to use Git for the past couple of days via the book Pragmatic Version Control Using Git. For the project I am using it on, I wanted to create a .gitignore file that excluded certain files and directories from my repository. I first tried to create a .gitignore.txt file and then rename the file once I had made the entries necessary. Windows explorer wouldn’t have it though and gave me a dialog that I must add a file name:

image 

I figured there had to be a way to do this via the command line, but I’m not that old nor command line inclined so I had to turn to Google. I quickly found the REN command that renames a file. You just have to enter REN followed by the file to rename and then the new name that you want. Problem solved.

If your interested in how to exclude a file type, just enter *.extension in your .gitignore file. To exclude a directory you can use directory-name followed by /

So your .gitignore file might look like (each exclusion needs to go on a new line):

*.pdf

App_Data/

So far, I have found Git useful and pretty easy to pick up. When it comes down to it, there really are only a half dozen or so commands that you end up using on a regular basis. Having a cheat sheet handy for the rest (the book comes with a pretty good one) is about all you need. The command line isn’t so bad after all…

Tags:

Git

Comments


About Me

I live and work in Salt Lake City, Utah. My background is in aviation. I have a degree in Aeronautical Science from Embry-Riddle Aeronautical University in Prescott, AZ. I have worked as a commercial airline pilot and most recently as a technical advisor for a charter airline.