You can check all branches available (remotes and local) and see the current one (marked with “*”):
$ git branch -a
The output of above command will be something like:
* master release-5.4 release-5.3 release-5.2 remotes/origin/HEAD -> origin/master remotes/origin/develop remotes/origin/master remotes/origin/release-5.0 remotes/origin/release-5.0.0-alpha remotes/origin/release-5.0.0-beta remotes/origin/release-5.1 remotes/origin/release-5.2 remotes/upstream/develop remotes/upstream/master remotes/upstream/release-5.0 remotes/upstream/release-5.0.0-alpha remotes/upstream/release-5.0.0-beta remotes/upstream/release-5.1 remotes/upstream/release-5.2
In the above output the “* master” means that the current branch is master.
We have the following branches:
In order to switch to one of the branches listed above, use the checkout command and create a local branch to track the remote branch. The syntax of git checkout
is:
$ git checkout -b <local_branch_name> <remote_branch_name without this part "remotes/">
In order to switch to branch develop you can use the following command:
$ git checkout -b develop origin/develop
Also there are tags which usually are originated from a release branch. For instance, tag 5.0.0 and 5.0.1 is originated from branch release-5.0.
To check all tags available, use:
$ git tag -l (list all tag names) 5.0.0 5.0.0-alpha 5.0.0-beta 5.0.1
If you want to checkout a specific version given by a tag and create a local branch to work on, you can use the following git command:
$ git checkout -b <local_branch_tag_name> <one_of_tag_name_listed>
For instance, to checkout 5.0.1 you can enter the following command:
$ git checkout -b 5.0.1 5.0.1
After selecting the right branch or tag, please, read the Source Code Instructions section.