Files
30-seconds-of-code/snippets/switch-to-branch.md
2023-04-28 22:15:54 +03:00

21 lines
402 B
Markdown

---
title: Switch to a branch
type: snippet
tags: [branch]
cover: bridge
dateModified: 2021-04-13T21:10:59+03:00
---
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>`.
```shell
git checkout <branch>
```
```shell
git checkout patch-1 # Switches to the branch named `patch-1`
```