Git is a versioning system. GitHub is popular public site for hosting git repositories. To add our code to a git repository we do the following one time:
git init git add [FILES TO ADD TO GIT] git remote add origin [REMOTE GITHUB REPO] git commit git push origin masterthen when we are ready to edit and make changes and save them we use the following:
git commit [FILE THAT WAS CHANGED] -m "[MESSAGE]" git push origin masterThat will ensure that we have a stored copy of the previous versions of the files along with our new changes on GitHub and in our local GIT repos.
git clone [REMOTE GITHUB REPO]Any time we have new changes to we can pull them down with
git pull origin master
One handy feature of git is to have it ignore certain files and directories that you don't want included in a repo. To use this, simply create and add a file called .gitignore to your repository and in the file list the files and directories you don't want included. This is especially important when using node config files. Here is a sample .gitignore file:
.DS_Store node_modules/ config.js