One safe idea
A branch is a separate line of work. Use it when you are adding a feature, fixing a bug, or trying an idea that may break the project.
Keep main as the working version. Do your messy work on a branch, test it, then merge it back.
Why branches help
In a hackathon team, two people may edit the project at the same time. One person works on login. Another updates the landing page. Branches stop both changes from getting mixed too early.
Even when you work solo, branches help your commit history. A recruiter can see one clean story: branch made, commits added, branch merged.
Create a branch
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
git status
git switch -c feature/add-expense-form
# edit files, run the project, then commit
git add .
git commit -m "Add expense form"
git switch mainName branches clearly
Use names that explain the work. Good names are short and specific.
Try feature/add-login, fix/navbar-mobile, docs/update-setup. Avoid names like final, changes, newbranch, or mywork.
Merge back safely
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
git switch main
git pull
git merge feature/add-expense-form
# test your app here
git branch -d feature/add-expense-formDo not panic
A merge conflict does not mean the repo is broken. It means Git found the same part of a file changed in two branches and wants you to choose.
Open the file, remove the conflict markers, keep the correct code, then commit the merge.
Conflict example
You may see a file like this after a merge conflict. The top part is from your current branch. The bottom part is from the branch being merged.
Edit it into the final version you want. Do not leave the marker lines in the file.
<<<<<<< HEAD
const title = "Campus Expense Tracker";
=======
const title = "Student Budget Tracker";
>>>>>>> feature/add-expense-form
# final file could be:
const title = "Student Budget Tracker";
# then finish the merge
git add src/config.js
git commitDo this now
Do each one yourself, then tap it to tick it off. The ticks are only a checklist for you: they are not marked or scored.
0 of 5 done
git status
git switch -c feature/readme-draft
# make a small edit
git add .
git commit -m "Draft setup note"
git switch main
git merge feature/readme-draft