Skip to content

Commit 2e5b326

Browse files
committed
Show the same menu when pressing space on a remote branch
The old behavior of showing a prompt to choose a name for the new local branch is still available via the 'n' keybinding.
1 parent a21db7a commit 2e5b326

File tree

10 files changed

+16
-12
lines changed

10 files changed

+16
-12
lines changed

docs/keybindings/Keybindings_en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ If you would instead like to start an interactive rebase from the selected commi
263263
| Key | Action | Info |
264264
|-----|--------|-------------|
265265
| `` <c-o> `` | Copy branch name to clipboard | |
266-
| `` <space> `` | Checkout | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
266+
| `` <space> `` | Checkout | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
267267
| `` n `` | New branch | |
268268
| `` M `` | Merge | Merge selected branch into currently checked out branch. |
269269
| `` r `` | Rebase | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ If you would instead like to start an interactive rebase from the selected commi
327327
| Key | Action | Info |
328328
|-----|--------|-------------|
329329
| `` <c-o> `` | ブランチ名をクリップボードにコピー | |
330-
| `` <space> `` | チェックアウト | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
330+
| `` <space> `` | チェックアウト | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
331331
| `` n `` | 新しいブランチを作成 | |
332332
| `` M `` | 現在のブランチにマージ | Merge selected branch into currently checked out branch. |
333333
| `` r `` | Rebase | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_ko.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
240240
| Key | Action | Info |
241241
|-----|--------|-------------|
242242
| `` <c-o> `` | 브랜치명을 클립보드에 복사 | |
243-
| `` <space> `` | 체크아웃 | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
243+
| `` <space> `` | 체크아웃 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
244244
| `` n `` | 새 브랜치 생성 | |
245245
| `` M `` | 현재 브랜치에 병합 | Merge selected branch into currently checked out branch. |
246246
| `` r `` | 체크아웃된 브랜치를 이 브랜치에 리베이스 | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_nl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ If you would instead like to start an interactive rebase from the selected commi
241241
| Key | Action | Info |
242242
|-----|--------|-------------|
243243
| `` <c-o> `` | Kopieer branch name naar klembord | |
244-
| `` <space> `` | Uitchecken | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
244+
| `` <space> `` | Uitchecken | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
245245
| `` n `` | Nieuwe branch | |
246246
| `` M `` | Merge in met huidige checked out branch | Merge selected branch into currently checked out branch. |
247247
| `` r `` | Rebase branch | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_pl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ If you would instead like to start an interactive rebase from the selected commi
240240
| Key | Action | Info |
241241
|-----|--------|-------------|
242242
| `` <c-o> `` | Copy branch name to clipboard | |
243-
| `` <space> `` | Przełącz | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
243+
| `` <space> `` | Przełącz | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
244244
| `` n `` | Nowa gałąź | |
245245
| `` M `` | Scal do obecnej gałęzi | Merge selected branch into currently checked out branch. |
246246
| `` r `` | Zmiana bazy gałęzi | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_ru.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ If you would instead like to start an interactive rebase from the selected commi
297297
| Key | Action | Info |
298298
|-----|--------|-------------|
299299
| `` <c-o> `` | Скопировать название ветки в буфер обмена | |
300-
| `` <space> `` | Переключить | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
300+
| `` <space> `` | Переключить | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
301301
| `` n `` | Новая ветка | |
302302
| `` M `` | Слияние с текущей переключённой веткой | Merge selected branch into currently checked out branch. |
303303
| `` r `` | Перебазировать переключённую ветку на эту ветку | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ If you would instead like to start an interactive rebase from the selected commi
340340
| Key | Action | Info |
341341
|-----|--------|-------------|
342342
| `` <c-o> `` | 将分支名称复制到剪贴板 | |
343-
| `` <space> `` | 检出 | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
343+
| `` <space> `` | 检出 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
344344
| `` n `` | 新分支 | |
345345
| `` M `` | 合并到当前检出的分支 | Merge selected branch into currently checked out branch. |
346346
| `` r `` | 将已检出的分支变基到该分支 | Rebase the checked-out branch onto the selected branch. |

docs/keybindings/Keybindings_zh-TW.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ If you would instead like to start an interactive rebase from the selected commi
351351
| Key | Action | Info |
352352
|-----|--------|-------------|
353353
| `` <c-o> `` | 複製分支名稱到剪貼簿 | |
354-
| `` <space> `` | 檢出 | Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch. |
354+
| `` <space> `` | 檢出 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
355355
| `` n `` | 新分支 | |
356356
| `` M `` | 合併到當前檢出的分支 | Merge selected branch into currently checked out branch. |
357357
| `` r `` | 將已檢出的分支變基至此分支 | Rebase the checked-out branch onto the selected branch. |

pkg/gui/controllers/remote_branches_controller.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ func NewRemoteBranchesController(
3535
func (self *RemoteBranchesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
3636
return []*types.Binding{
3737
{
38-
Key: opts.GetKey(opts.Config.Universal.Select),
39-
// gonna use the exact same handler as the 'n' keybinding because everybody wants this to happen when they checkout a remote branch
40-
Handler: self.withItem(self.newLocalBranch),
38+
Key: opts.GetKey(opts.Config.Universal.Select),
39+
Handler: self.withItem(self.checkoutBranch),
4140
GetDisabledReason: self.require(self.singleItemSelected()),
4241
Description: self.c.Tr.Checkout,
4342
Tooltip: self.c.Tr.RemoteBranchCheckoutTooltip,
@@ -184,3 +183,7 @@ func (self *RemoteBranchesController) newLocalBranch(selectedBranch *models.Remo
184183

185184
return self.c.Helpers().Refs.NewBranch(selectedBranch.RefName(), selectedBranch.RefName(), nameSuggestion)
186185
}
186+
187+
func (self *RemoteBranchesController) checkoutBranch(selectedBranch *models.RemoteBranch) error {
188+
return self.c.Helpers().Refs.CheckoutRemoteBranch(selectedBranch.FullName(), selectedBranch.Name)
189+
}

pkg/i18n/english.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ func EnglishTranslationSet() TranslationSet {
10281028
CheckoutTooltip: "Checkout selected item.",
10291029
CantCheckoutBranchWhilePulling: "You cannot checkout another branch while pulling the current branch",
10301030
TagCheckoutTooltip: "Checkout the selected tag tag as a detached HEAD.",
1031-
RemoteBranchCheckoutTooltip: "Checkout a new local branch based on the selected remote branch. The new branch will track the remote branch.",
1031+
RemoteBranchCheckoutTooltip: "Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head.",
10321032
CantPullOrPushSameBranchTwice: "You cannot push or pull a branch while it is already being pushed or pulled",
10331033
FileFilter: "Filter files by status",
10341034
CopyToClipboardMenu: "Copy to clipboard",
@@ -1899,6 +1899,7 @@ keybinding:
18991899
- Squashing fixups using 'shift-S' now brings up a menu, with the default option being to squash all fixup commits in the branch. The original behaviour of only squashing fixup commits above the selected commit is still available as the second option in that menu.
19001900
- Push/pull/fetch loading statuses are now shown against the branch rather than in a popup. This allows you to e.g. fetch multiple branches in parallel and see the status for each branch.
19011901
- The git log graph in the commits view is now always shown by default (previously it was only shown when the view was maximised). If you find this too noisy, you can change it back via ctrl+L -> 'Show git graph' -> 'when maximised'
1902+
- Pressing space on a remote branch used to show a prompt for entering a name for a new local branch to check out from the remote branch. Now it just checks out the remote branch directly, letting you choose between a new local branch with the same name, or a detached head. The old behavior is still available via the 'n' keybinding.
19021903
`,
19031904
},
19041905
}

0 commit comments

Comments
 (0)