Skip to content
GitTree

Lesson 8 · Everyday work

Read history without moving HEAD

Record the leftover radius edit, document the actual history, and compare revision sets with file-tree differences. Selecting a graph row is inspection, not a branch switch.

Progress saved in this browser.

Playing loads the video from YouTube (privacy-enhanced mode).

English narration · English and Arabic captions

Open the video pageWatch on YouTube

What you will learn

  • Distinguish HEAD, a selected commit, author and committer.
  • Follow parents and first-parent ancestors.
  • Read two-dot/three-dot log sets without confusing them with diff endpoints.
  • Compare two actual commits in GitTree without rewriting history.

Before you start

You start where lesson 7 ended: main has three commits from lessons 5 to 7. Only the CSS radius remains modified: HEAD and the index hold CSS-02-INDEX, the working file CSS-02-WORKING. No remote. The video was recorded with Git 2.52.0 and GitTree 2.0 on Ubuntu 24.04: both commits, the document, the graph inspection, the search, Jump to HEAD and Compare References were operated in the app, and the terminal checks ran against what the app created, so the commit ids shown are the ones the app compared. The diverged-branch case is a diagram: no feature branch was created. Nothing was run on macOS or Windows, and Ubuntu is the only Linux system recorded. GitTree's source minimum is Git 2.39.0; once you are signed in, local inspection and commits are on the Free plan.

Concept

A commit records a tree, metadata and parent IDs. A branch names a commit; HEAD usually names the current branch. Clicking another graph row changes the app's selection, not HEAD, the branch or disk files. Author records who wrote the work; committer records who recorded this commit. They happen to be the same fictional identity here.

For a linear chain, HEAD~1 follows one first-parent edge; HEAD~2 follows two. HEAD^1 is the first parent; HEAD^2 means the second parent of one commit, not “two commits back.” A non-merge commit has no second parent.

git log A..B means reachable from B excluding reachable from A. git log A...B means symmetric difference of reachability. git diff A B compares endpoint trees, while git diff A...B compares merge-base(A,B) to B. A three-dot log and three-dot diff do not ask the same question. On this linear history some results happen to agree; do not generalize that coincidence to diverged branches. Revision notation, diff semantics.

Reading/selecting/searching changes no index, working bytes or refs. This lesson's two explicit commits do move local main: radius first, documentation second. No remote changes.

Complete history document

First commit the existing radius edit as shown below. Then create docs/history.md with this full UTF-8/LF body; its final item describes the commit that will contain the document, not an invented SHA.

File excerpt · markdown
# GitTree Features history

The first-parent chain on main, oldest first:

1. feat: add the GitTree Features hero
2. feat: add styling and local project checks
3. feat: refine the hero and card spacing
4. style: finish the card radius change
5. docs: record logs-and-revisions practice

After this document is committed, HEAD names item 5.
HEAD~1 names item 4; HEAD~2 names item 3.
Selecting a graph row does not move HEAD.
These labels are descriptions, not fabricated commit SHAs.

All identities in this project are fictional.

Do not add the optional practice notebook or extra clean-up commits to this five-commit chain.

In GitTree

  1. Palette Show Working Changes (Command/Ctrl+Shift+P to open palette). Click styles.css under Unstaged Files. Confirm only radius 0.5rem → 0.75rem remains; do not repeat the earlier width change.
  2. Choose its Stage File row action, enter Summary style: finish the card radius change, ordinary options off, then Commit Changes to 1 File (or Command/Ctrl+Enter once). Verify four commits and clean tracked status.
  3. Palette New File… → Path from the project folder = docs/history.md → Create. Paste the full document and Save. Back to Graph → Show Working Changes → Stage File for docs/history.md.
  4. Summary docs: record logs-and-revisions practice; commit one file. The expected chain now has five commits.
  5. Click the root hero row. Inspect its real SHA, subject, author/committer and root commit parent status in commit details. Click the latest row; compare its parent relation. Do not invoke Check Out This Commit merely to read it.
  6. In commit details toggle View all files to distinguish the commit's whole tree from only changed paths; inspect the document at its recorded revision. This does not modify the working file.
  7. Return Back to Graph; use palette Search Loaded History or Command/Ctrl+F while the graph is active, type radius and inspect matching loaded history. In an editor the same chord finds editor text. Clear the search afterwards. A loaded-history search is not a server-wide history query.
  8. Palette Jump to HEAD, Command/Ctrl+Shift+H, locates the current tip. Selection/search can move while native git symbolic-ref --short HEAD still reports main.
  9. Use native git rev-parse HEAD~2 to obtain its real commit ID; no fixed course SHA is supplied. Palette Compare References… (repo.compareRefs) opens Compare References. In Old side, paste that measured ID and select its commit option; in New side, choose HEAD. The picker accepts a commit ID, not a promise that arbitrary revision expressions are parsed there.
  10. Under What to compare, choose The two endpoints then Compare. Expect docs/history.md and styles.css differences for this chain. Reopen/change comparison and choose Changes since the merge base with the same sides: linear ancestry makes the endpoint result coincide here. Do not infer symmetric-log behavior from that view. Cancel exits without changing history.

In the terminal

Native mutation alternative, only before corresponding app success:

Command · bash
git add -- styles.css
git commit --quiet -m "style: finish the card radius change"

Both succeeded silently. After saving the full document:

Command · bash
git add -- docs/history.md
git commit --quiet -m "docs: record logs-and-revisions practice"
git log --reverse --format=%s

Full observed chain:

Output
feat: add the GitTree Features hero
feat: add styling and local project checks
feat: refine the hero and card spacing
style: finish the card radius change
docs: record logs-and-revisions practice

Inspect set versus tree:

Command · bash
git log --format=%s HEAD~2..HEAD
git log --format=%s HEAD~2...HEAD

Each query separately printed:

Output
docs: record logs-and-revisions practice
style: finish the card radius change

They coincide only because the older endpoint is an ancestor here.

Command · bash
git diff --name-only HEAD~2 HEAD
git rev-list --count HEAD
git symbolic-ref --short HEAD

Outputs in order:

Output
docs/history.md
styles.css
5
main

The two named files are tree differences, not the identities of the two commits returned by log.

Command · bash
git rev-parse --verify --quiet HEAD^2

Observed no stdout/stderr and exit 1: latest commit is not a merge. Use HEAD~2 for two first-parent steps instead. To identify a real comparison ID:

Command · bash
git rev-parse HEAD~2

Read its actual output during rehearsal; a measured SHA changes with commit metadata and must not be copied from a model label.

Result

At the end of this lesson: five commits on main in the documented order; tracked work/index clean, no remote or operation in progress. CSS now has radius 0.75rem and docs/history.md is committed. Reading a past graph row has not detached HEAD.

Common mistakes

  • Treating selected row as checked-out commit: inspect HEAD independently.
  • Reading ^2 as ~2: second parent versus two first-parent edges.
  • Applying symmetric-log meaning to three-dot diff: diff is directional from merge base to right.
  • Assuming graph search covers unloaded/unfetched history.

If something goes wrong

A missing revision can mean insufficient ancestry, a typo or a shallow boundary, not corruption. Verify the chain and selected repository. Clear app filters before concluding a commit vanished. Do not fetch from an arbitrary provider, reset or checkout merely to repair a selection. If a document already exists, inspect its content before applying this new-file step.

Check your understanding

Answer each question, then read why. Questions marked “Required” count toward completing the lesson.

  1. Question 1 of 6

    Clicking an older graph row does what here?

    Choose one answer.

  2. Question 2 of 6

    Which statements are correct on this five-commit linear chain?

    Choose every answer that applies.

  3. Question 3 of 6
    Required

    Which subjects are in HEAD~2..HEAD after history.md is committed?

    Choose one answer.

  4. Question 4 of 6
    Required

    Main is H5; feature F descends from H3. What is main...feature in git log?

    Choose one answer.

  5. Question 5 of 6

    Does git diff A...B mean the symmetric log set?

    Choose one answer.

  6. Question 6 of 6
    Required

    Which observations prove the finished checkpoint?

    Choose every answer that applies.

0 of 6 correct

Answer the required questions correctly to complete the lesson.

Checked in this browser.

Practice

Select an older row and prove HEAD stays main. Explain why two log entries can correspond to differences in only two paths. Changed input: for a separate branch with one commit from H3 while main is at H5, predict main..feature contains only that feature commit, but main...feature also includes H4/H5. Do not create that branch in the canonical checkpoint; use a disposable copy.

Your own confirmation: the site cannot see your computer.

To complete the lesson, answer the required questions correctly and confirm the practical exercise.

Recap

  • Selection and HEAD have different owners.
  • Parent notation and revision sets describe ancestry, not file changes.
  • Compare real resolved endpoints and label the question clearly.

Glossary terms introduced

Commit — إيداع; parent — إيداع أب; ref — مرجع; revision — مراجعة; range — نطاق; merge base — أساس الدمج; author — المؤلف; committer — المُودِع.

Video transcript

The narration of the video, cue by cue.

Show the transcript
  1. Read history without moving your current branch.
  2. First inspect the one independent edit left by L007.
  3. Record the radius as its own local commit.
  4. Write the documented chain using subjects, not invented hashes.
  5. The document becomes the fifth commit in this chain.
  6. Verify the actual order before teaching revision notation.
  7. A branch name and a selected graph row are different.
  8. Selecting the root only changes the inspected commit.
  9. The full tree is not just the list changed in that commit.
  10. Search the loaded history, not a promised server-wide archive.
  11. Return the selection to the current tip.
  12. The terminal independently confirms the checked-out branch.
  13. Two parent steps are not the second parent of one commit.
  14. This non-merge commit has no second parent.
  15. These sets agree here because the endpoints are ancestors.
  16. A tree difference names files, not a set of commit identities.
  17. Use a measured commit ID in the comparison picker.
  18. Compare the two resolved trees without changing refs.
  19. This mode compares the merge base with the right side.
  20. A diverged graph makes the two log ranges differ.
  21. Three-dot log and three-dot diff answer different questions.
  22. A mistaken selection needs navigation, not destructive recovery.
  23. Verify the chain and unchanged HEAD before branching.
  24. Next, create and switch branch names deliberately.