ADVERTISEMENT
Google AdSense Slot (headerLeaderboard)

Set your Publisher ID in src/config/ads.ts to display live ads.

Git Version Control Tutorial• 6 min read

Branching & Switching: Parallel Feature Development

git branch, git switch, git checkout, and HEAD pointers

Branches allow software engineers to diverge from the main production codebase to develop features, experiment, or fix bugs in complete isolation.

Understanding Branches and the HEAD Pointer

In Git, a branch is simply a lightweight, movable pointer to a specific commit hash (40 characters).

HEAD is a special reference pointing to the current branch/commit you are currently working on.

git switch -c feature/auth: Modern Git command to create and switch to a new branch in one step.

git branch -d branch-name: Safely deletes a merged branch.

Branching Workflow Commands
# List all local branches (* denotes active branch)
git branch

# Create and switch to new feature branch
git switch -c feature/dark-mode

# Make changes and commit on feature branch
git add theme.css
git commit -m "style: implement dark theme palette"

# Switch back to main branch
git switch main
git switch -c replaces the legacy git checkout -b command.
ADVERTISEMENT
Google AdSense Slot (inContentBanner)

Set your Publisher ID in src/config/ads.ts to display live ads.

Test Yourself With Exercise

+15 XP

What is a Git branch under the hood?