Git — Create Branch
Create Branch
git branch feature-name
Create and Switch
git checkout -b feature-name
# Or
git switch -c feature-name
Branch from Specific Commit
git branch feature-name commit-hash
Branch from Remote
git checkout -b feature origin/feature
View Branches
# Local
git branch
# Remote
git branch -r
# All
git branch -a
# Verbose
git branch -v
Branch Naming
| Pattern | Example |
|---|---|
| feature/ | feature/login |
| bugfix/ | bugfix/header |
| hotfix/ | hotfix/security |
| release/ | release/1.0 |
Mini Practice
- Create a branch
- Switch to new branch
- View all branches
- Follow naming conventions
Up Next
Continue with Switch Branch — switching branches.
Related Topics
Frequently Asked Questions about Create Branch
What is Create Branch in Git?
Create Branch is a fundamental concept in Git. This lesson explains it step by step with clear examples, making it easy for beginners to understand.
How do I learn Create Branch?
Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Create Branch.
Why is Create Branch important in Git?
Create Branch is essential for Git development. Understanding this concept will help you write better code and solve real-world problems more effectively.