← All bricks

git · Beginner

git: Version Control from the Command Line

Get fluent with the git command line — initialise a repo, stage and commit changes, read status and diffs, branch and merge, undo mistakes, and connect to a remote, one small command at a time.

Almost every developer uses git, but most learned it as a handful of memorised incantations and never built a mental model. This course starts from an empty folder and grows a tiny notes project, introducing one git command at a time and explaining exactly what each one does and why. You'll learn to read git's output instead of fearing it — the status codes, the commit hashes, the branch marker, the diff signs — and you'll practise the everyday loop of edit, stage, commit. By the end you can branch and merge, stash work in progress, undo a commit you didn't mean to make, and push to a remote. Writing a file and running the git command on it are kept as separate steps, so each idea lands on its own.

What you'll build

  • Initialise a repository and configure your identity
  • Stage and commit changes, and read status and the log
  • Inspect what changed with diff and show
  • Branch, switch, and merge work together
  • Ignore files, stash work, tag releases, and undo a commit
  • Connect a repository to a remote and push

Contents

  1. Start a repository
  2. Tell git who you are
  3. Set your email too
  4. Create the first file
  5. Check the status
  6. Stage the file
  7. See what's staged
  8. Make the first commit
  9. Read the history
  10. Change a tracked file
  11. See what changed
  12. Commit the change
  13. List the branches
  14. Start a branch
  15. Work on the branch
  16. Commit on the branch
  17. Switch back
  18. Merge the branch
  19. Picture the history
  20. Ignore some files
  21. Watch the noise vanish
  22. Stage and inspect it
  23. Diff the staged version
  24. Commit the ignore rules
  25. Start something half-finished
  26. Stash the work away
  27. Bring it back
  28. Throw away an edit
  29. Look at one commit
  30. Tag a release
  31. List the tags
  32. Add a remote
  33. Push your work
  34. Pull from the remote
  35. Undo the last commit
  36. Clone an existing project
  37. Where to go from here