Goal: Learn how to create and switch branches.
-
Create a New Branch:
- Create a new branch called
feature-branch:git branch feature-branch
- Create a new branch called
-
Switch to the New Branch:
- Switch to the
feature-branch:git checkout feature-branch
- Switch to the
-
Make Changes and Commit:
- Create a new file called
feature.txtand add some text to it. - Add and commit the file:
git add feature.txt git commit -m "Added feature.txt"
- Create a new file called
-
Switch Back to the Main Branch:
- Switch back to the main branch:
git checkout main
- Switch back to the main branch: