Branching Strategy and Pull Requests in Practice
How to build new features without putting at risk the live site that customers are already using.
What you will learn
- Never push experiments directly to the "main" branch.
- Create a branch with: git checkout -b feature/new-page.
- When the code is finished and tested, open a pull request (PR) to merge it into main.
- Vercel automatically creates a test URL with your changes for every open PR.
The life cycle of a feature
1. Create a branch -> 2. Make your changes -> 3. Commit & push -> 4. Check the preview URL -> 5. Merge into main.
Step by step
Create a new branch and push it to GitHub
git checkout -b feature/novi-modul git add . git commit -m "feat: implement module" git push -u origin feature/novi-modulThis branch lives separately from the main production code.
Tip from practice
In your repository's GitHub settings, turn on a branch protection rule for main so nobody can accidentally overwrite stable code.