If you don’t have Git installed on your system, you can find downloads and instructions for your operating system on the Git home page.
We won’t discuss version control in detail in this book, but if you’re not using it, you should be. If you’re not familiar with Git, I encourage you to use this book as an opportunity to practice.
First, from your project root, initialize a repository:
$ git init
This will create a project repository for you (there’s now a hidden directory called .git in your project root).
Inevitably, there will be some files you never want tracked in version control: build artifacts, temporary files, and the like. These files can be explicitly excluded in a file called .gitignore. Go ahead and create a .gitignore file now with the following contents:
# npm debugging logs npm-debug.log* # project dependencies node_modules # OSX folder attributes .DS_Store # temporary files *.tmp *~
If there are any other “junk” files that you know of, you’re welcome to add them here (for example, if you know your editor creates .bak files, you would add *.bak to this list).
A command you’ll be running a lot is
git status, which tells you the current status of your repository. Go ahead and run it now. You should see:
$ git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore nothing added to commit but untracked files present (use "git add" ...