Git Commands Reference
This lesson gathers the course’s commands in one place. Each row names the command, the job it does, and the lesson that teaches it.
One command to remember
The version command is the fastest check that Git is ready.
$ git --versionExample
$ git --versionKey points
- Commands that save work sit at the top.
- Commands that look at history sit in the middle.
- Commands that share work sit near the end.
- Keep this page open while you work.
- The full course teaches every row here.
Here, the check prints the version. It is the first command to run on any new machine.
Try it Yourself
Edit the code, then press Run.
Running is simulated
The commands in this course
| Command | Job | Lesson |
|---|---|---|
| git init | Start a repository | Your First Repository |
| git status | Report what changed | Check Status |
| git add | Stage changes | Stage Changes |
| git commit | Save a snapshot | Make a Commit |
| git log | List snapshots | View the Log |
| git show | Open one snapshot | Inspect a Commit |
| git diff | Print changed lines | Compare Changes with Diff |
| git blame | Name the snapshot per line | Blame a Line |
| git branch | List, make, or delete branches | Create a Branch |
| git switch | Move between branches | Switch Branches |
| git merge | Join a branch | Merge a Branch |
| git rebase | Replay work on a newer base | Rebase a Branch |
| git cherry-pick | Copy one snapshot | Cherry-Pick a Commit |
| git restore | Throw away or unstage changes | Undo Unstaged Changes |
| git reset | Move the branch pointer back | Undo the Last Commit |
| git revert | Undo a snapshot with a new one | Revert a Commit |
| git reflog | List every move of the pointer | Recover with Reflog |
| git stash | Put work aside | Stash Your Work |
| git tag | Name one snapshot | Create a Tag |
| git remote | List remotes | What Is a Remote |
| git clone | Copy a whole repository | Clone a Repository |
| git push | Send snapshots to the remote | Push to GitHub |
| git pull | Bring new work from the remote | Pull Changes |
| git fetch | Download without joining | Fetch Before You Pull |
Exercise
Where do you look up a command you forgot?