Git and GitHub course menu
Git Practice Project: Simulate a Team Workflow
Practise a real team workflow alone using two folders: branches, pushes, a merge conflict, a release tag and a hotfix. Every command runs on your own computer with a local remote.
On this page
You do not need a team to practise team work. In this project, you play two developers using two folders and one shared repository on your own computer. You will use branches, push and pull, hit a real conflict, tag a release and ship a hotfix.
Step 1: Create the shared repository#
A bare repository has history but no working files, exactly like the copy on GitHub. It stands in for GitHub here:
git init -q --bare -b main team.git
git clone -q team.git asha
git clone -q team.git ravi
lswarning: You appear to have cloned an empty repository.
warning: You appear to have cloned an empty repository.
asha
ravi
team.gitStep 2: Asha starts the project#
cd asha
echo "# Team Menu" > README.md
printf 'Dosa 60\nIdli 40\n' > menu.txt
git add .
git commit -q -m "Start the menu"
git push -q -u origin main
git log --oneline890cc71 Start the menuStep 3: Each developer takes a task#
Ravi adds a drink on one branch, and Asha changes a price on another. Both edit menu.txt.
cd ../ravi
git pull -q
git switch -q -c add-drinks
echo "Tea 20" >> menu.txt
sed -i 's/Dosa 60/Dosa 70/' menu.txt
git commit -q -am "Add tea and raise dosa price"
git push -q -u origin add-drinkscd ../asha
git switch -q -c update-prices
sed -i 's/Dosa 60/Dosa 65/' menu.txt
git commit -q -am "Raise dosa price to 65"
git push -q -u origin update-pricesStep 4: Merge the first branch#
Ravi's work is reviewed and merged first. On GitHub, this is the green button on a pull request. Here we do it from the terminal:
cd ../ravi
git switch -q main
git merge -q --no-ff --no-edit add-drinks
git push -q
git log --oneline --graph* f766e10 Merge branch 'add-drinks'
|\
| * 550870d Add tea and raise dosa price
|/
* 890cc71 Start the menuStep 5: The conflict#
Asha now wants to merge, and both developers changed the dosa price. So main goes into the update-prices branch first, which is what you do when a pull request shows a conflict:
cd ../asha
git fetch -q
git merge origin/main
cat menu.txtAuto-merging menu.txt
CONFLICT (content): Merge conflict in menu.txt
Automatic merge failed; fix conflicts and then commit the result.
<<<<<<< HEAD
Dosa 65
=======
Dosa 70
>>>>>>> origin/main
Idli 40
Tea 20They agree on 65, and Ravi's new tea stays. Asha resolves it, commits, and merges:
printf 'Dosa 65\nIdli 40\nTea 20\n' > menu.txt
git add menu.txt
git commit -q --no-edit
git switch -q main
git pull -q
git merge -q --no-ff --no-edit update-prices
git push -q
git log --oneline --graph* c0f85c7 Merge branch 'update-prices'
|\
| * 617c7bb Merge remote-tracking branch 'origin/main' into update-prices
| |\
| |/
|/|
* | f766e10 Merge branch 'add-drinks'
|\ \
| * | 550870d Add tea and raise dosa price
|/ /
| * fd597f1 Raise dosa price to 65
|/
* 890cc71 Start the menuStep 6: Clean up#
Delete the finished branches, on the server and locally:
git push -q origin --delete add-drinks update-prices
git branch -d update-prices
git fetch -q --prune
git branch -aDeleted branch update-prices (was 617c7bb).
* main
remotes/origin/HEAD -> origin/main
remotes/origin/mainStep 7: Release#
Tag the first version:
git tag -a v1.0.0 -m "First menu release"
git push -q origin v1.0.0
git describev1.0.0Step 8: Hotfix#
A customer reports a typo in README.md. Ravi fixes it from main, and Asha pulls the change:
cd ../ravi
git switch -q main
git pull -q
git branch -d add-drinks
git switch -q -c fix-readme
echo "# Team Menu (2026)" > README.md
git commit -q -am "Add year to the title"
git switch -q main
git merge -q --no-edit fix-readme
git push -q
git tag -a v1.0.1 -m "Fix title"
git push -q origin v1.0.1
cd ../asha
git pull -q
git log --oneline --decorate -n 2Deleted branch add-drinks (was 550870d).
d2e3ab1 (HEAD -> main, tag: v1.0.1, origin/main, origin/HEAD) Add year to the title
c0f85c7 (tag: v1.0.0) Merge branch 'update-prices'Both developers now have the same history, with two tagged releases.
Extend the project#
- Do the same again using a real private repository on GitHub, with real pull requests. Invite a friend to play Ravi.
- Add a GitHub Actions workflow that checks
menu.txtis not empty. - Replace a merge with
git rebase origin/main, and compare the graph. - Delete a branch by mistake, and recover it with the reflog.
Key takeaway#
Finished this lesson?