π Day 10: Git Branching

1 min read
What is Git Branching?
Git branching lets you work on new features or fixes without affecting your main code. Itβs like creating a copy of your project where you can experiment safely.
Why Use Branches?
Keep
main
stableWork on multiple features at once
Test ideas without risk
Collaborate easily
Common Branch Types
main β Stable code
feature/ β New features
bugfix/ β Fixing issues
hotfix/ β Quick production fixes
Essential Commands
bashCopyEditgit branch # list branches
git checkout -b new-feature # create + switch
git add .
git commit -m "message"
git checkout main
git merge new-feature
git branch -d new-feature # delete branch
Quick Example
bashCopyEditgit checkout -b login-form
# Make changes
git add . && git commit -m "Add login form"
git checkout main
git merge login-form
Best Practices
Use clear names like
feature/payment-page
Commit often
Delete branches after merging
Use pull requests in teams
Thank youu
0
Subscribe to my newsletter
Read articles from Sumith S Raikar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
