Git & GitHub
Type real Git commands into a small café’s website repository and watch what each one moves: files into the staging area, commits onto branches, branches into each other, and your work up to GitHub and back.
Briefing
You've just been handed the repository for a small café's website, and you'll run real Git commands in it. Each one moves something you can watch: a file into staging, a commit onto a branch, a branch into another, your work up to GitHub and back.
You'll learn to
- Stage, commit and undo changes, and say what a commit really is
- Branch, merge, and resolve a merge conflict
- Push to GitHub, pull someone else's work, and open a pull request
- Pick the right undo — restore, revert or reset — in public and in private
Git Essentials: The Everyday CommandsOptional warm-upThe staging area, what a branch really is, merge conflicts, and revert versus reset. About ten minutes.Only what’s ready
Why the staging area exists
Take it back
restore, and undoing staged changes
What a commit really is
Snapshots, parents, labels
A branch is a label
branch, switch, and a safe place to try things
Bring it home
merge, the simple case
When both moved on
The merge commit
Merge conflict
When two people change the same line
Your repository and GitHub’s
Remotes, push, pull, clone
Put it on GitHub
remote add, push -u
Someone pushed first
Rejected pushes, and pull
Pull requests
clone, branch, push, review, merge
Undo in public
revert, versus rewriting history