Repository: jesseduffield/lazygit (language: go)

Issue:
Branches - switch branch to previous one
**Topic**
Is there a keyboard shortcut to quickly switch between 2 branches (back to previous).

**Your thoughts**
I'm doing it with `git checkout -` in the terminal and I wonder whether there is a way to achieve the same behaviour in Lazygit.



Discussion / hints:
Unfortunately there isn't, but you could use a `customCommand` to define a mapping yourself.

Just an example:
```
  - key: 't'
    command: 'git checkout -'
    context: 'localBranches'
    description: 'Checkout last branch'
```
It's not documented but you can also press 'c' to bring up the branch checkout prompt and then enter '-' and hit enter. Only three keypresses!

Fix patch:
diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md
index 3c57562f23f..535d7f0aba3 100644
--- a/docs/keybindings/Keybindings_en.md
+++ b/docs/keybindings/Keybindings_en.md
@@ -141,7 +141,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
 <pre>
   <kbd>&lt;c-o&gt;</kbd>: Copy branch name to clipboard
   <kbd>i</kbd>: Show git-flow options
-  <kbd>&lt;space&gt;</kbd>: Checkout
+  <kbd>&lt;space&gt;</kbd>: Checkout, enter '-' to switch to last
   <kbd>n</kbd>: New branch
   <kbd>o</kbd>: Create pull request
   <kbd>O</kbd>: Create pull request options
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index 15deab9259c..2d84fdd6442 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -868,7 +868,7 @@ func EnglishTranslationSet() TranslationSet {
 		CantRebaseOntoSelf:                  "You cannot rebase a branch onto itself",
 		CantMergeBranchIntoItself:           "You cannot merge a branch into itself",
 		ForceCheckout:                       "Force checkout",
-		CheckoutByName:                      "Checkout by name",
+		CheckoutByName:                      "Checkout by name, enter '-' to switch to last",
 		NewBranch:                           "New branch",
 		NoBranchesThisRepo:                  "No branches for this repo",
 		CommitWithoutMessageErr:             "You cannot commit without a commit message",


Test patch: