Branches, remotes and PRs
Isolate work, push it safely and merge through review.
What you will be able to do
- Create and switch branches
- Push to a remote
- Open a pull request and resolve conflicts
A branch is a movable pointer to a commit. Feature branches let you experiment without disturbing main. Pull requests add review and discussion.
git switch -c feature/pricing
# make changes
git add .
git commit -m "Add pricing comparison table"
git push -u origin feature/pricing
# after review and merge
git switch main
git pull
git branch -d feature/pricingResolving a conflict
A conflict happens when two branches change the same lines. Git marks the overlap; you choose the final content, remove the markers, then commit.
<<<<<<< HEAD
const price = 19;
=======
const price = 24;
>>>>>>> feature/pricingYour turn
MediumStart a feature
Create and switch to a branch called feature/search, then push it with an upstream.
BASH · starter
# your commands hereCheck your understanding before moving on.
Knowledge checkQuestion 1
What does git push -u origin feature/pricing do?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.