Junior — Middle
How to switch to another branch in version control system?
sobes.tech AI
Answer from AI
To switch to another branch in the Git version control system, use the command:
git checkout <branch_name>
For example, to switch to the feature branch, run:
git checkout feature
In newer versions of Git, it is recommended to use the git switch command:
git switch <branch_name>
If the branch does not exist locally but exists on the remote repository, you can create and switch to it with:
git checkout -b <branch_name> origin/<branch_name>
Or using git switch:
git switch -c <branch_name> --track origin/<branch_name>