Git
Git keeps a history of your code, so you can go back to an earlier version, and on Windows it comes as Git for Windows, with Git Bash to type its commands in.
Novice · Operating System · Git · Updated
After this lesson you can
- Name what Git for Windows installs, and say where you type Git commands
Key takeaways
- Git keeps a history of your project. Each commit is a saved point you can go back to.
- On Windows you install Git for Windows. It brings Git, Git Bash and Git Credential Manager.
- You type Git commands in Git Bash. Each one starts with git, such as git status.
Windows only. Think of a video game that saves your progress at checkpoints. If something goes wrong, you go back to the last checkpoint instead of starting over. Git does that for your code. It is a version control system: it keeps a history of your project, and each saved point, called a commit, is one you can go back to.
You will use Git every day in this course, to save your work and to keep a copy of it on GitHub.
What Git for Windows installs
On Windows, you install Git for Windows. One install gives you three things:
| Part | What it does |
|---|---|
| Git | The program that keeps your project's history |
| Git Bash | The terminal you type Git commands in, and the one you use for the whole bootcamp |
| Git Credential Manager | Signs you in to GitHub through your web browser, then remembers you |
You install it in Setup: Install Git, Git Bash, and connect to GitHub, later in this topic.
What Git commands look like
Every Git command starts with git, then what you want it to do. You type them in Git Bash, inside your project's folder. Here are the three you will use most, to save a change and send it to GitHub:
git add -A
git commit -m "Add the shopping list page"
git push
git add -A gets every change ready to save, git commit saves them as one commit with a message that says what changed, and git push sends your commits to GitHub. The Working with Git topic explains each step.
Try it. After you install Git, open Git Bash and type git --version. It prints the version of Git you have, such as git version 2.56.0.windows.1.
Check yourself
2 questions to try on the lesson page.
So what
Git is the safety net under all your work: with a commit for each step, a mistake costs you minutes, not days.
Key terms
- Git
- Version control