09 — Branches and pull requests
A branch is a safe copy of the project where you can work without disturbing main. A pull request is the request to bring that work back.
When you need a branch
- The change is big enough that half-finished work would break things.
- Somebody should look at it before it goes live.
- You want to try an idea and be able to throw it away.
For a typo in a document, committing straight to main is fine.
Creating a branch in the browser
While committing (chapter 03), choose Create a new branch for this commit and start a pull request, name the branch, and commit. Good names describe the work:
docs/vlan-notes
fix/wrong-gateway
feature/report-export
Opening a pull request
- Go to Pull Requests → New Pull Request.
- Pick the source branch (yours) and the target (
main). - Title = what the change does. Description = why, plus anything reviewers should check.
- Press Create Pull Request.
Review
- Reviewers comment on individual lines from the Files Changed tab.
- Push more commits to the same branch — the pull request updates itself.
- When it is approved, press Merge Pull Request, then delete the branch.
Merge conflicts
If main changed the same lines you did, KabaForge asks you to resolve it. From your computer:
git switch my-branch
git fetch origin
git merge origin/main
# open the marked files, keep the correct lines
git add .
git commit
git push
Protecting main
Settings → Branches → Add rule: require pull requests and approvals before anything reaches main. Recommended as soon as more than one person works in the repository.