Kusina: a dessert section
Last updated
Ana started a desserts branch last week. Since then Joaquin has changed the README on main. Your job: finish the dessert section on its branch, bring it into main, settle the conflict that's waiting, and tag the result v1.0 for Lola Remy's birthday.
By the end of this lesson you can
- Build a piece of work on a branch in several commits
- Merge it into main and settle a conflict
- Mark the result with an annotated tag
The brief
You're Ana, in kusina, on the desserts branch. Since you made it, Joaquin committed "Explain the file layout in the README" on main.
- On desserts, add three dessert recipes (turon, halo-halo, ube halaya, or your own family's), each in its own commit. Use
editto write them. - Also on desserts, change the README's line that starts "Each recipe is" so it mentions the desserts. (Joaquin changed that same line on main. That's the planted conflict.)
- Switch to main and merge desserts. Settle the conflict so the line keeps both Joaquin's explanation and yours.
- Tag the merge
v1.0with an annotated tag.
Use git status and git log --oneline --graph --all as often as you like.
Build it
- On desserts, three new commits that each add a recipe
- A commit on desserts that changes the README
- On main, desserts merged in with a merge commit
- The conflict settled: no markers, merge finished
- The README keeps Joaquin’s line about build_index.py
- An annotated tag
v1.0 - Every message is a short command that says what changed
Working folder
no changes
Staging area
nothing staged
Repository
10 commits on desserts
You are in ~/kusina on desserts, a branch Ana made last week. Joaquin has committed to main since.
Commit graph
78ba41dmain Explain the file layout in the README67e435dHEAD →desserts Cover the leche flan with foilba04ca2Add lumpiang shanghai recipe98a5edcAdd a script that builds the index paged078487Make the sinigang steps clearer145dc1eAdd pancit bihon recipe52d1f4dSay how much salt goes in the adobo1c17fadAdd a README9c53888Add leche flan recipe1f359a2Add sinigang recipe601c654Add adobo recipe
Spot the trap: markers carried along
Ana merges main into desserts instead, to test there first. A conflict comes up; she settles half of it, runs git add . and git commit, then merges desserts into main. It goes through as a fast-forward.
What happens if…
Check your history
Run git log --oneline --graph. You should see the desserts commits on one line and Joaquin's README commit on the other, joining at your merge commit, with tag: v1.0 beside it.
Sources
Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.
- Pro Git: Basic Branching and Merging: a branch, a merge and a conflict, start to finish
- Git documentation: git-merge: merging and resolving
- Git documentation: git-tag: annotated tags for releases