Update Main In Parallel
Part of the Version Control section of Coddy's Terminal journey — lesson 53 of 58.
Meanwhile on main, the docs need a small fix that is unrelated to the feature work.
Updating both branches in parallel is the most realistic scenario, and the merge in the next lesson will be a true three-way merge instead of a fast-forward.
Challenge
EasySwitch back to main (the feature branch already has the new commit). Append the line This is the project readme. to readme.md, then stage and commit with the message Expand readme.
Print the contents of readme.md.
Cheat sheet
Working on multiple branches in parallel enables true three-way merges (as opposed to fast-forward merges that occur when only one branch has new commits).
Switch between branches with:
git checkout branch-nameEach branch tracks its own commits independently, allowing parallel development.
Try it yourself
git init -q -b main
git config user.name "Todo Dev"
git config user.email "todo@coddy.tech"
git add .
git commit -q -m "Seed todo list"
git switch -q -c add-task
echo "walk the dog" >> todo.txt
git add todo.txt
git commit -q -m "Add walk task"
cat todo.txt
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Version Control
2Getting Started
Initialize A RepositoryThe .git FolderConfigure Your IdentityGit StatusRecap - First Repo8Merging
What Is A MergeFast-Forward MergeThree-Way MergeMerge ConflictsResolve A ConflictRecap - Merge Master11Feature Branch Project
Project OverviewInitialize Main3Tracking Changes
The Staging AreaGit AddGit CommitModifying A Tracked FileGit LogRecap - First Commits6Recipe Site Project
Project OverviewInitialize And Ignore