Merge back into main
Learn
Merge it back
When the work is ready, switch to the branch you want to bring it into, and merge:
git switch main
git merge hotfix
Here main hasn't moved since the branch was made, so Git simply moves main forward to
include the branch's commits (a fast-forward). When both branches have moved on, Git
creates a merge commit instead. Either way, git log on main now includes the work.
Your task
Switch back to main and git merge feature to fold the feature work in. Run git log --oneline — main now contains the Add feature commit.
Interview prep
Comfort with branch → commit → merge is the baseline expectation for collaborating on a team.
Why work on a branch instead of committing straight to main?
A branch isolates in-progress work so main stays stable and releasable. You can experiment, commit incrementally, and have the work reviewed (a pull request) before merging — and if it doesn't pan out, you just delete the branch. It also lets several people work in parallel without stepping on each other.