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:
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…