Version Control with Git
Version control is very important to computer programming, no matter what language or framework you use! It allows you to track changes to your code over time, and back it up in case of emergency.
When to use
Version control is something you'll use every day. Any time you make a significant change to your code, you'll need to version control save it.
To set up Git the first time, enter these commands in the terminal:
- git config --global user.name "Your Name"
- git config --global user.email "firstname.lastname@example.org"
- git config --global push.default matching
- git config --global alias.co checkout
- git init
Be sure to use the same email address that you plan to use later on at github.com
Sign up for an account on github.com. All the code will be public on github.com unless you pay to keep it private.
To Save your code and commit your changes, use these two commands in the terminal
- git add .
- git commit -am "Commit Message Here"
Version control is a great way to back up code, but it also helps several developers to work on code in groups and merge their code together in the future.
Hints & tips
- git is the type of version control we'll use
- git is run locally on your cloud development environment
- after we save our file with git, we'll push it to github.com for safe keeping
Lesson notes are only available for subscribers.