Files
30-seconds-of-code/snippets/switch-to-branch.md
Isabelle Viktoria Maciohsek c909c7b7e1 Add switch to branch
2021-04-04 14:09:09 +03:00

18 lines
335 B
Markdown

---
title: Switch to a branch
tags: branch,beginner
---
Switches to an existing branch.
- Use `git checkout <branch>` to switch to the specified branch.
- Note: In newer versions of git, you can also use `git switch <branch>`.
```sh
git checkout <branch>
```
```sh
git checkout patch-1 # Switches to the branch named `patch-1`
```