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