0
0
Gitdevops~15 mins

Working in multiple branches simultaneously in Git - Mini Project: Build & Apply

Choose your learning style9 modes available
Working in multiple branches simultaneously
📖 Scenario: You are working on a software project where you need to develop two features at the same time. To keep your work organized, you will use Git branches. This way, you can switch between features without mixing their code.
🎯 Goal: Learn how to create and switch between multiple Git branches to work on different features simultaneously.
📋 What You'll Learn
Create a new branch called feature1 from the current branch
Create another new branch called feature2 from the current branch
Switch to the feature1 branch
Switch to the feature2 branch
List all branches to confirm both branches exist
💡 Why This Matters
🌍 Real World
Developers often work on multiple features or bug fixes at the same time. Using branches keeps their work separate and organized.
💼 Career
Knowing how to manage branches is essential for collaboration and version control in software development jobs.
Progress0 / 4 steps
1
Create the first branch feature1
Use the command git branch feature1 to create a new branch called feature1 from the current branch.
Git
Need a hint?

Use git branch followed by the branch name to create a new branch.

2
Create the second branch feature2
Use the command git branch feature2 to create another new branch called feature2 from the current branch.
Git
Need a hint?

Repeat the branch creation command with the new branch name.

3
Switch to the feature1 branch
Use the command git checkout feature1 to switch to the feature1 branch.
Git
Need a hint?

Use git checkout followed by the branch name to switch branches.

4
Switch to the feature2 branch and list branches
Use the command git checkout feature2 to switch to the feature2 branch. Then use git branch to list all branches and confirm both feature1 and feature2 exist.
Git
Need a hint?

The * shows the current branch. Both branches should be listed.