Skip to content

Commit 910b265

Browse files
committed
Closes #463: adds checkout terminal command
Changes rebase & reset terminal commands to apply to all commit nodes
1 parent 6cb99d3 commit 910b265

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Added
9+
- Adds *Checkout Commit (via Terminal)* command (`gitlens.terminalCheckoutCommit`) to commit node(s) of the *GitLens* explorer — closes [#463](https://github.com/eamodio/vscode-gitlens/issues/463)
10+
811
### Changed
912
- Changes commit search by sha to jump directly to the commit (if one is found), rather than having to click through to the commit
1013
- Updates settings descriptions to better support the new settings editor in vscode
14+
- Changes *Rebase to Commit (via Terminal)* command (`gitlens.terminalRebaseCommit`) to apply to all commit node(s) of the *GitLens* explorer
15+
- Changes *Reset to Commit (via Terminal)* command (`gitlens.terminalResetCommit`) to apply to all commit node(s) of the *GitLens* explorer
1116

1217
### Fixed
1318
- Fixes [#462](https://github.com/eamodio/vscode-gitlens/issues/462) - Source Control shortcut on macOS (⌃⇧G) shouldn't be overridden

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ The repository view provides a full Git repository explorer, which has the follo
163163
- *Open Branch in Remote* (if available), *Compare with Remote* (if available), *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Compare Ancestry with Working Tree* (when available), *Select for Compare*, *Open Directory Compare with Working Tree*, *Checkout Branch (via Terminal)*, *Merge Branch (via Terminal)*, *Rebase (Interactive) Branch (via Terminal)*, *Rebase (Interactive) Branch to Remote (via Terminal)*, *Squash Branch into Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Delete Branch (via Terminal)*, *Create Tag (via Terminal)...*, and *Refresh* commands
164164
- Revisions (commits) expand to show the set of files changed, complete with status indicators for adds, changes, renames, and deletes
165165
- Context menus for each revision (commit) provide
166-
- *Open Commit in Remote* (if available), *Open All Changes*, *Open All Changes with Working Tree*, *Open Files*, *Open Revisions*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Show Commit Details*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
166+
- *Open Commit in Remote* (if available), *Open All Changes*, *Open All Changes with Working Tree*, *Open Files*, *Open Revisions*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Show Commit Details*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Checkout Commit (via Terminal)*, *Rebase to Commit (via Terminal)*, *Reset to Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
167167
- Context menus for each changed file provide
168168
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Apply Changes*, *Compare with Selected* (when available), *Select for Compare*, and *Show Commit File Details* commands
169169
- Inline toolbars for each changed file provide an *Open File* command
@@ -238,7 +238,7 @@ An on-demand, [customizable](#gitlens-results-explorer-settings "Jump to the Git
238238
- A context menu provides *Clear Results*, and *Refresh* commands
239239
- Revisions (commits) expand show the set of files changed, complete with status indicators for adds, changes, renames, and deletes
240240
- Context menus for each revision (commit) provide
241-
- *Open Commit in Remote* (if available), *Open All Changes*, *Open All Changes with Working Tree*, *Open Files*, *Open Revisions*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Show Commit Details*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Rebase to Commit (via Terminal)* (when available), *Reset to Commit (via Terminal)* (when available), *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
241+
- *Open Commit in Remote* (if available), *Open All Changes*, *Open All Changes with Working Tree*, *Open Files*, *Open Revisions*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Show Commit Details*, *Compare with HEAD*, *Compare with Working Tree*, *Compare with Selected* (when available), *Select for Compare*, *Cherry Pick Commit (via Terminal)* (when available), *Push to Commit (via Terminal)* (when available), *Revert Commit (via Terminal)* (when available), *Checkout Commit (via Terminal)*, *Rebase to Commit (via Terminal)*, *Reset to Commit (via Terminal)*, *Create Branch (via Terminal)...*, *Create Tag (via Terminal)...*, and *Refresh* commands
242242
- Context menus for each changed file provide
243243
- *Open Changes*, *Open Changes with Working File*, *Open File*, *Open Revision*, *Open File in Remote*, *Open Revision in Remote*, *Copy Commit ID to Clipboard*, *Copy Commit Message to Clipboard*, *Apply Changes*, *Compare with Selected* (when available), *Select for Compare*, and *Show Commit File Details* commands
244244

package.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,6 +1936,11 @@
19361936
"title": "Squash Branch into Commit (via Terminal)",
19371937
"category": "GitLens"
19381938
},
1939+
{
1940+
"command": "gitlens.explorers.terminalCheckoutCommit",
1941+
"title": "Checkout Commit (via Terminal)",
1942+
"category": "GitLens"
1943+
},
19391944
{
19401945
"command": "gitlens.explorers.terminalCherryPickCommit",
19411946
"title": "Cherry Pick Commit (via Terminal)",
@@ -2483,6 +2488,10 @@
24832488
"command": "gitlens.explorers.terminalSquashBranchIntoCommit",
24842489
"when": "false"
24852490
},
2491+
{
2492+
"command": "gitlens.explorers.terminalCheckoutCommit",
2493+
"when": "false"
2494+
},
24862495
{
24872496
"command": "gitlens.explorers.terminalCherryPickCommit",
24882497
"when": "false"
@@ -3094,22 +3103,27 @@
30943103
{
30953104
"command": "gitlens.explorers.terminalPushCommit",
30963105
"when": "viewItem == gitlens:commit:current",
3097-
"group": "8_gitlens@1"
3106+
"group": "8_gitlens@2"
30983107
},
30993108
{
31003109
"command": "gitlens.explorers.terminalRevertCommit",
31013110
"when": "viewItem == gitlens:commit:current",
3102-
"group": "8_gitlens@1"
3111+
"group": "8_gitlens@3"
3112+
},
3113+
{
3114+
"command": "gitlens.explorers.terminalCheckoutCommit",
3115+
"when": "viewItem =~ /gitlens:commit\\b/",
3116+
"group": "8_gitlens@4"
31033117
},
31043118
{
31053119
"command": "gitlens.explorers.terminalRebaseCommit",
3106-
"when": "viewItem == gitlens:commit:current",
3107-
"group": "8_gitlens@2"
3120+
"when": "viewItem =~ /gitlens:commit\\b/",
3121+
"group": "8_gitlens@5"
31083122
},
31093123
{
31103124
"command": "gitlens.explorers.terminalResetCommit",
3111-
"when": "viewItem == gitlens:commit:current",
3112-
"group": "8_gitlens@3"
3125+
"when": "viewItem =~ /gitlens:commit\\b/",
3126+
"group": "8_gitlens@6"
31133127
},
31143128
{
31153129
"command": "gitlens.explorers.openFile",

src/views/explorerCommands.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export class ExplorerCommands extends Disposable {
8585
this.terminalSquashBranchIntoCommit,
8686
this
8787
);
88+
commands.registerCommand('gitlens.explorers.terminalCheckoutCommit', this.terminalCheckoutCommit, this);
8889
commands.registerCommand('gitlens.explorers.terminalCherryPickCommit', this.terminalCherryPickCommit, this);
8990
commands.registerCommand('gitlens.explorers.terminalPushCommit', this.terminalPushCommit, this);
9091
commands.registerCommand('gitlens.explorers.terminalRebaseCommit', this.terminalRebaseCommit, this);
@@ -371,6 +372,12 @@ export class ExplorerCommands extends Disposable {
371372
this.sendTerminalCommand('merge', `--squash ${node.ref}`, node.repoPath);
372373
}
373374

375+
terminalCheckoutCommit(node: ExplorerNode) {
376+
if (!(node instanceof CommitNode)) return;
377+
378+
this.sendTerminalCommand('checkout', `${node.ref}`, node.repoPath);
379+
}
380+
374381
terminalCherryPickCommit(node: ExplorerNode) {
375382
if (!(node instanceof CommitNode)) return;
376383

0 commit comments

Comments
 (0)