Let's say I have a repository with three branches
1 - master
2 - feature1
3 - feature2
You can then perform a git clone
which will clone the entirety of the repo onto your local machine and will default you to the master branch; however, if you want to instead see the code on one of the feature branches, you will need to "checkout" that code on your local machine. You have at least three ways of things panning out here:
git checkout master
Git will tell you that you are already on the master branch
git checkout nonExistantBranch
Git will tell you that the requested branch does not exist
git checkout feature1
Git will successfully "checkout" the code. So, when you open any of the files on your local machine, they will reflect the code found on that specific branch only. This is the option that you want.
If you are getting an error saying the branch doesn't exist, but you think it does, perform a git branch -v
which will show all the branches in the current repository.
There is a another option
git checkout -b newBranch
This will tell git to switch to "newBranch" and if it doesn't exist, create it, using the code that is currently found on the branch you currently have checked out.