learn git.
0/25 done
learn git/remotes and beyond/course 25 of 25

You know git: cheat sheet and final exam

Twenty-five courses, one table, one last workout.

5 min read·3 sections·5 tasks
the key idea

You now hold the complete daily toolkit — status to read, add and commit to save, branches to experiment, push and pull to share.

01The table

Everything these courses taught, on one screen. Bookmark this page; come back whenever your hands forget what your head knows. Commands are grouped by the job they do, in the order you met them.

[bash]· the whole course, one screen
# --- reading the state ---
git status                # how are things?
git log --oneline         # the album, newest first
git diff                  # what changed on disk
git diff --staged         # what is on the checklist

# --- saving work ---
git add <file>            # stage one file
git add .                 # stage everything
git commit -m "message"   # take the photo

# --- undoing ---
git restore <file>        # discard unstaged edits
git restore --staged <f>   # unstage, edits kept
git commit --amend -m "m"  # fix the last commit

# --- branches ---
git branch                 # list branches
git branch <name>          # create a branch
git switch <name>          # move to a branch
git switch -c <name>       # create and move
git merge <branch>         # bring work into here
git merge --abort          # emergency exit

# --- sharing ---
git remote add origin <url>
git push -u origin main    # first push
git push                   # every push after
git pull                   # get the team's work
git clone <url>            # download a project
When lost: status

Any confusion, any moment, any year of your career: run git status and read the hints. It is the map legend of the entire territory.

02Where to go next

You now hold the complete daily toolkit, and that is genuinely most of git. The natural next steps arrive when a real situation asks for them: pull requests on GitHub, for proposing changes to projects you do not own; git stash, for shelving half-done work for five minutes; git rebase, a cleaner alternative to merge that rewrites your branch onto the latest main.

None of them are needed today. Do not learn them out of fear — learn them when a real project presents the situation, and each will take an afternoon. The foundation you just built is the hard part; everything else is vocabulary.

  • —pull requests — GitHub's way of discussing a branch before merging it
  • —git stash — shelve work-in-progress, clean the desk, come back to it
  • —git rebase — replay your commits on top of the newest main
  • —recovering deleted files — the album remembers everything

03The final exam

One repository, five moves, no help. You have used every one of these commands before — init, file, add, commit, branch, log. Take it slowly, run status between steps, and enjoy how ordinary it all feels now. That ordinariness is the diploma.

>>

Practice

The final exam: from nothing to a project with a branch, all by yourself.

[practice]· a real terminal, safely simulated
practice terminal — everything here is simulated, nothing can break
type 'help' to see the commands this terminal understands
~/my-project (main) $
Your tasks0/5 done
  1. 01.Create a file called app.txt with any text.

    hint: Try: echo "my app" > app.txt

  2. 02.Stage it.

    hint: Try: git add app.txt (or git add .)

  3. 03.Commit it with the exact message: first release

    hint: Try: git commit -m "first release"

  4. 04.Create a branch called beta.

    hint: Try: git branch beta (or git switch -c beta)

  5. 05.Look at your finished work: the graph, the whole story.

    hint: Try: git log --oneline --graph --all