A branch points to a commit
The main branch copies no files: it is a movable pointer on commit 84e98ce. HEAD marks where you are; git branch shows it as * main.
The main branch copies no files: it is a movable pointer on commit 84e98ce.
HEAD marks where you are; git branch shows it as * main.
The main branch copies no files: it is a movable pointer on commit 84e98ce. HEAD marks where you are; git branch shows it as * main.
git switch -c farewell creates the branch at the current commit and switches to it.
Two labels on the same commit, and HEAD moved to farewell.
git switch -c farewell creates the branch at the current commit and switches to it. Two labels on the same commit, and HEAD moved to farewell.
git add and git commit: 1c21b09 is born; only the HEAD branch moves.
git switch main takes HEAD back: main is still on the previous commit.
git add and git commit: 1c21b09 is born; only the HEAD branch moves. git switch main takes HEAD back: main is still on the previous commit.
git merge farewell from main: main has no commits of its own.
Git only moves the pointer forward: a fast-forward creates no commit.
git branch -d farewell deletes the label; the commit stays.
git merge farewell from main: main has no commits of its own. Git only moves the pointer forward: a fast-forward creates no commit. git branch -d farewell deletes the label; the commit stays.
git switch -c author and a commit: c236346 is born, author moves.
On main, another commit on farewell.txt: e4fe6bd.
They diverged: each branch has a commit the other lacks.
git switch -c author and a commit: c236346 is born, author moves. On main, another commit on farewell.txt: e4fe6bd. They diverged: each branch has a commit the other lacks.
git merge author compares both tips with their common ancestor, 1c21b09.
It combines the changes in a merge commit: a commit with two parents.
main moves to the merge commit; git branch -d author drops the extra label.
git merge author compares both tips with their common ancestor, 1c21b09. It combines the changes in a merge commit: a commit with two parents. main moves to the merge commit; git branch -d author drops the extra label.
formal-greeting and main each change, in their own commit, the same line of greeting.txt.
Git does not guess the right one: it stops the merge with CONFLICT.
In the file it leaves both versions between markers.
formal-greeting and main each change, in their own commit, the same line of greeting.txt. Git does not guess the right one: it stops the merge with CONFLICT. In the file it leaves both versions between markers.
You pick the final text and delete the markers: Good morning, whole world.
git add marks it as resolved; git commit finishes the merge with a merge commit.
git branch -d formal-greeting deletes the label; the commits stay in the graph.
You pick the final text and delete the markers: Good morning, whole world. git add marks it as resolved; git commit finishes the merge with a merge commit. git branch -d formal-greeting deletes the label; the commits stay in the graph.