Skip to content
Journey to Code

Series

Commit to Success: Mastering Git From Init to Push

/ Git field notes

cat README.md

Learn Git from your first commit and how to undo it, through branches, remotes, stash and releases. Every lesson has a practice terminal where you type the commands yourself, and a check at the end. You need a terminal and a text editor, and nothing else.

$ git log --graph --allIllustrative history
A feature branch merging into main Read left to right: two commits on main, a feature branch with two commits, then a merge back into main and a final HEAD commit. HEAD -> main feature

Branch, work in parallel, merge. Read left → right.

WALKTHROUGH / SHOWN, NOT RUNNO REPOSITORY REQUIRED

Understand the graph, not just the commands.

Two branches.
One shared history.

Step through a small, conflict-free example. See which commit each branch names, where HEAD points, and why a merge can have two parents. This is a visual walkthrough, not a terminal: no commands execute and no repository is changed.

Now break it yourself

The walkthrough above is a script. This one is yours: make commits, branch, merge, and cause a conflict on purpose. It runs in your browser against a made-up repository, so nothing can go wrong. The lesson on branching and merging explains what you will see.

The lessons themselves have a different kind of practice. Each one ends with a terminal where you type the real commands. There is no editor and no answer key. A wrong command does not advance, and hint gives a nudge when you ask. Each lesson also has a few questions to check what stuck.

The interactive sandbox needs JavaScript. Without it, the walkthrough above and the lessons cover the same ground: commits, branches, merges, and conflicts.

Inspect an example session and diff
Terminal / Example session
$ git switch -c feature/docs
$ git diff
$ git add README.md
$ git commit -m "Clarify setup"
README.md / Illustrative diff
@@ -1,2 +1,2 @@
 # Getting started
-Follow the old setup guide.
+Follow the updated setup guide.

git help --by-goal

New to Git? Start at the first lesson. Already commit every day? Find your goal below.

I want to…Then read
Install Git, read a project's history, and see what I changedGit Out of Your Comfort Zone
Set my name, email, and editor so my commits are mineGit Ready to Branch Out (setup)
Make my first commits and write a good messageGetting Started with Git
Undo something I just did, or get back a commit I lostUndo Mistakes Safely
Work on a feature without breaking main, merge it, fix a conflictBranching and Merging Strategies
Push my work, get a teammate's changes, understand a rejected pushRemote Repositories and Collaboration
Park half-done work, fix my last commit, or copy a commit to another branchAdvanced Git Features
Pick a team workflow, write commit messages tools can read, tag a releaseGit Best Practices and Workflows
Rebase, bisect, search history, or write a hookThe Advanced Git series

git log --oneline --reverse

The lessons, in reading order. Follow the colored branch paths from top to bottom. This illustrative learning tree is not repository history.

  1. Git Out of Your Comfort ZoneInstall Git, read a project's history with log, see your edits with diff, and create, rename and delete branches. · 9 min read
  2. Git Ready to Branch OutTell Git your name and email, pick an editor other than Vim for commit messages, and check that the settings stuck. · 4 min read
  3. Getting Started with GitTurn a folder into a Git repository, save your first two commits, and check what the next one will contain before you take it. · 8 min read
  4. Undo Mistakes SafelyThrow away edits, fix the last commit, undo a commit with revert, and get a lost commit back with reflog. Committed work is almost always recoverable. · 7 min read
  5. Branching and Merging StrategiesCreate and switch branches, merge them back, resolve a merge conflict, and learn what rebasing is and when to avoid it. · 8 min read
  6. Remote Repositories and CollaborationConnect a project to a remote such as GitHub, push your commits, pull other people's, and know what to do about a rejected push. · 9 min read
  7. Advanced Git FeaturesStash unfinished work, amend and squash your own recent commits, and cherry-pick a single commit onto another branch. · 8 min read
  8. Git Best Practices and WorkflowsCompare Git workflows, write commit messages that tools can read, and tag a release, then pick a workflow for a solo app or a team. · 9 min read