GitHub workflow assignment covering branching, merging, releases, collaborators, pull requests, code review, Git LFS, and git stash.
This repo was built entirely locally first (all commits/branches/merges below are real, tested git history) and is ready to be pushed to GitHub. The steps that require an actual GitHub account (creating the remote repo, adding a collaborator, opening PRs, requesting review, cutting releases, pushing the LFS file) are listed at the bottom as a runbook — they need a human GitHub account/teammate and haven't been done yet.
git init -b main— initialized the repo, addedREADME.mdand.gitignore, committed.git checkout -b dev— created thedevbranch and addedcalculator.pywithadd,subtract,multiply,divide, and thesquare_rootmethod commented out asTODO(exact code from the assignment).git checkout main && git merge --no-ff dev— mergeddevintomain.git tag -a v1.0 -m "Release v1.0: CalculatorPlus with basic arithmetic operations"— tagged release v1.0.git checkout dev && git checkout -b feature/sqrt— createdfeature/sqrtoffdevand implementedsquare_root(self, x): return math.sqrt(x), uncommented the demo call in__main__, committed.- Simulated a critical bug reported on
main: while still mid-feature onfeature/sqrt, switched back withgit checkout dev, fixeddivide()to raiseValueError("Cannot divide by zero.")onb == 0, committed ondev. - Merged the hotfix straight to
main(git checkout main && git merge --no-ff dev) since the bug was reported there. - Went back to
feature/sqrtand rangit merge devto pull the divide-by-zero hotfix in, keeping the feature branch up to date while the fix landed elsewhere. - Simulated code review feedback: a reviewer would flag that
math.sqrt()on a negative number raises a crypticmath domain error— added an explicitif x < 0: raise ValueError(...)check insquare_root()and committed as "Address review feedback". git checkout dev && git merge --no-ff feature/sqrt— mergedfeature/sqrtintodevpost-approval.- Tested
calculator.pyondev(ran it, verified all 5 operations print correctly). git checkout main && git merge --no-ff dev— mergeddevintomain.git tag -a v2.0 -m "Release v2.0: CalculatorPlus with square_root feature and divide-by-zero fix"— tagged release v2.0.
Final git log --oneline --graph --all for this section shows the full dev → hotfix → feature → review → merge → release flow.
- Create the actual private GitHub repo
git_assignment_HeroVired. - Add a classmate as a collaborator.
- Open the real pull request
feature/sqrt→main, request their review, get it approved. - Push the
v1.0/v2.0tags and publish them as GitHub Releases. - Review at least one classmate's repository (for the 2 bonus points).
git checkout main && git checkout -b lfs— created thelfsbranch.- Added
.gitattributestracking*.bin,*.zip,*.mp4through Git LFS (the content Git LFS itself would generate viagit lfs track), committed.
git-lfs is not installed on this machine, and actually pushing a 200MB+ file uses your real GitHub account's LFS storage/bandwidth quota — both need to happen on your side. Exact commands are in the Runbook below.
git checkout main && git checkout -b geometry-calculator— created the branch, addedgeometry_calculator.pywithcalculate_circle_area/calculate_rectangle_areaimplemented and the__main__demo calls commented out asTODO(exact code from the assignment), committed.git checkout -b feature/circle-area(fromgeometry-calculator) — started the circle-area feature (radius = 5) but left it incomplete.git stash push -m "WIP: circle area feature"— stashed the incomplete work. Verified withgit status --shortthat the working directory was clean.git checkout geometry-calculator && git checkout -b feature/rectangle-area— created the rectangle branch.- Started the rectangle-area feature (
length = 10,width = 6), left it incomplete,git stash push -m "WIP: rectangle area feature". Verified clean tree again. git checkout feature/circle-area && git stash pop stash@{1}(the stash stack is global across branches, so the circle-area stash had to be popped by its explicit index since the rectangle-area stash was pushed after it) — retrieved the WIP, completed theprint(...)call, tested it (78.53981633974483for radius 5), committed as "Implement circle area feature".git checkout feature/rectangle-area && git stash pop— retrieved the rectangle WIP, completed theprint(...)call, tested it (60for 10×6), committed as "Implement rectangle area feature".git stash listconfirmed the stash stack was empty after both pops — nothing left stashed.
- Push both
feature/circle-areaandfeature/rectangle-area. - Open two pull requests, both targeting
dev. - Get them reviewed by a classmate/teammate, then merge both into
dev, and finally intomain.
Everything above is done and verified locally. These remaining steps need your GitHub login, a real classmate's username, and (for Q2) real disk/network usage against your account's LFS quota — so they're left for you to run.
cd git_assignment_HeroVired
# Using the GitHub CLI (recommended, if you have `gh` installed & authenticated):
gh repo create git_assignment_HeroVired --private --source=. --remote=origin
# Or manually: create a private repo named "git_assignment_HeroVired" on github.com,
# then:
git remote add origin git@github.com:<your-username>/git_assignment_HeroVired.git
# Push every branch and the tags:
git push -u origin main
git push origin dev
git push origin feature/sqrt
git push origin geometry-calculator
git push origin feature/circle-area
git push origin feature/rectangle-area
git push origin lfs
git push origin --tagsGitHub UI: repo → Settings → Collaborators → Add people → enter your classmate's GitHub username. Or via CLI:
gh api repos/<your-username>/git_assignment_HeroVired/collaborators/<classmate-username> -X PUTgh pr create --base main --head feature/sqrt \
--title "Add square_root feature" \
--body "Implements Calculator.square_root(), includes the divide-by-zero hotfix picked up from dev, and validates negative input per review feedback."Then, on GitHub: request review from your collaborator → wait for approval → merge into dev (this was already done locally in step 10 above, but the actual PR/approval trail needs to exist on GitHub for grading).
gh release create v1.0 --title "v1.0" --notes "CalculatorPlus with basic arithmetic operations"
gh release create v2.0 --title "v2.0" --notes "CalculatorPlus with square_root feature and divide-by-zero fix"Or GitHub UI: repo → Releases → Draft a new release → pick the v1.0/v2.0 tag.
# Install Git LFS (one-time)
brew install git-lfs
git lfs install
git checkout lfs
git lfs track "*.bin" # already reflected in .gitattributes, but this is the real command
# Create a large test file (>200MB) — do this only when you're ready to actually
# push it, since it will consume your GitHub LFS bandwidth/storage quota:
dd if=/dev/urandom of=big_file.bin bs=1m count=210
git add .gitattributes big_file.bin
git commit -m "Add 210MB test file tracked via Git LFS"
git push origin lfsThen, on a different machine (or a fresh clone), clone the repo and confirm the LFS file downloads correctly:
git clone git@github.com:<your-username>/git_assignment_HeroVired.git
cd git_assignment_HeroVired
git lfs pull
ls -lh big_file.bin # should show the full ~210MB, not a small pointer fileNote: GitHub's standard push limit is 100MB per file without LFS, and free-tier LFS storage/bandwidth is 1GB/month — a 210MB file will eat a large chunk of that quota in one push. Consider this before running the commands above on a real account.
gh pr create --base dev --head feature/circle-area \
--title "Implement circle area feature" --body "Completed via git stash workflow."
gh pr create --base dev --head feature/rectangle-area \
--title "Implement rectangle area feature" --body "Completed via git stash workflow."Request review, get approval, merge both into dev, then merge dev into main.
Find a classmate's git_assignment_HeroVired repo, open one of their pull requests, and leave a real review comment (GitHub UI: PR → Files changed → comment, or Review changes).
- Make the repo public after the due date (per the marking scheme, item f).
- Put the repo URL into a
.txt/.docx/.pdffile. - Upload that file to Vlearn.
Everything above was run and verified in this environment:
python3 calculator.py— all 5 operations print correctly on every relevant branch.python3 geometry_calculator.py— both circle (78.53981633974483) and rectangle (60) areas print correctly.git stash list— empty after both stashes were popped.git log --oneline --graph --all— full history matches the workflow described above.