Add switch to last branch
This commit is contained in:
18
snippets/switch-to-last-branch.md
Normal file
18
snippets/switch-to-last-branch.md
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Return to previous branch
|
||||
tags: branch,beginner
|
||||
---
|
||||
|
||||
Switches back to the last branch.
|
||||
|
||||
- Use `git checkout -` to switch back to the previous branch.
|
||||
|
||||
```sh
|
||||
git checkout -
|
||||
```
|
||||
|
||||
```sh
|
||||
git checkout patch-1
|
||||
git checkout master
|
||||
git checkout - # Switches to `patch-1`
|
||||
```
|
||||
Reference in New Issue
Block a user