Switch to a Branch
You have been working on a project in a Git repository named https://github.com/labex-labs/git-playground. Your team has created a new branch named feature-1 to work on a new feature. You need to switch to the feature-1 branch to continue working on the feature.
- Clone the Git repository:
git clone https://github.com/labex-labs/git-playground.git
- Navigate to the repository directory:
cd git-playground
- List all the branches in the repository:
git branch
Output:
feature-1
* master
- Switch to the
feature-1 branch:
git checkout feature-1
Output:
Switched to branch 'feature-1'
- Verify that you are now on the
feature-1 branch:
git branch
Output:
* feature-1
master