git_assignment_HeroVired/main(Branch) │ ├── calculator.py ├── geometry_calculator.py └── README.md
git_assignment_HeroVired/lfs(Branch) │ ├── calculator.py ├── large_file.bin (via Git LFS) ├── README.md └── .gitattributes
You are part of a development team building a Python app CalculatorPlus, which performs:
- Addition
- Subtraction
- Multiplication
- Division
- Square Root (new feature)
- Repository name:
git_assignment_HeroVired - Set repository visibility: Private
- Created branch:
dev - Added calculator code to the
devbranch
def square_root(self, x):
return math.sqrt(x)- Tested the feature in the main block.
- Merged
dev→main - Created Release v1.0
- Added one classmate as a collaborator for code review.
Created new branch:
feature/sqrt
Added the square root implementation.
A bug was reported in the divide() function. Fix applied:
def divide(self, a, b):
if b == 0:
raise ValueError("Cannot divide by zero.")
return a / bUpdated feature branch:
git pull origin dev
- Created PR from
feature/sqrt→dev - Requested review from collaborator
- Made changes based on feedback
- Merged after approval
- Performed testing in
dev - Merged
dev→main - Created Release v2.0
git checkout -b lfs
git lfs install
git lfs track "*.bin"
git lfs track "*.pdf"
git add .gitattributes
git commit -m "Configured Git LFS"
git add large_file.bin
git commit -m "Added 200MB file using Git LFS"
git push origin lfs
On another system:
git clone <repo-url>
git lfs pull
Large files downloaded correctly.
This section demonstrates using Git stash to switch between incomplete features.
- Calculate area of circle
- Calculate area of rectangle
git checkout -b geometry-calculator
Added file changes and committed
git checkout -b feature/circle-area
Started writing circle-area code changes.
git stash
git checkout -b feature/rectangle-area
Started rectangle-area code changes.
git stash
git checkout feature/circle-areaa
git stash pop
Completed feature → committed → pushed.
git checkout feature/rectangle-area
git stash pop
Completed feature → committed → pushed.
feature/rectangle-area >> dev feature/circle-areaa >> dev
dev >> main