Skip to content

Latest commit

 

History

History
217 lines (143 loc) · 17.4 KB

github-command-palette.md

File metadata and controls

217 lines (143 loc) · 17.4 KB
title intro versions shortTitle redirect_from
GitHub Command Palette
Use the command palette in {% data variables.product.product_name %} to navigate, search, and run commands directly from your keyboard.
feature
command-palette
GitHub Command Palette
/get-started/using-github/github-command-palette

{% data reusables.command-palette.beta-note %}

{% data reusables.command-palette.default %}

About the {% data variables.product.prodname_command_palette %}

You can navigate, search, and run commands on {% data variables.product.product_name %} with the {% data variables.product.prodname_command_palette %}. The command palette is an on-demand way to show suggestions based on your current context and resources you've used recently. You can open the command palette with a keyboard shortcut from anywhere on {% data variables.product.product_name %}, which saves you time and keeps your hands on the keyboard.

Fast navigation

When you open the command palette, the suggestions are optimized to give you easy access from anywhere in a repository, personal account, or organization to top-level pages like the Issues page. If the location you want isn't listed, start entering the name or number for the location to refine the suggestions.

Screenshot of the command palette. The "Issues" and "Pull requests" pages for the current repository are suggested.

Easy access to commands

The ability to run commands directly from your keyboard, without navigating through a series of menus, may change the way you use {% data variables.product.prodname_dotcom %}. For example, you can switch themes with a few keystrokes, making it easy to toggle between themes as your needs change.

Screenshot of the command palette. "switch theme to dark" is in the command palette input, and results for changing your theme are displayed.

Opening the {% data variables.product.prodname_command_palette %}

Open the command palette using one of the following default keyboard shortcuts:

  • Windows and Linux: Ctrl+K or Ctrl+Alt+K
  • Mac: Command+K or Command+Option+K

You can customize the keyboard shortcuts you use to open the command palette in the Accessibility section of your user settings. For more information, see "Customizing your {% data variables.product.prodname_command_palette %} keyboard shortcuts."

When you open the command palette, it shows your location at the top left and uses it as the scope for suggestions (for example, the octo-org organization).

Screenshot of the command palette. "octo-org" is highlighted with an orange outline.

Note

  • If you are editing Markdown text, open the command palette with Ctrl+Alt+K (Windows and Linux) or Command+Option+K (Mac).{% ifversion projects-v2 %}
  • If you are working on a {% data variables.projects.project_v2 %}, a project-specific command palette is displayed instead. For more information, see "AUTOTITLE."{% endif %}

Customizing your {% data variables.product.prodname_command_palette %} keyboard shortcuts

The default keyboard shortcuts used to open the command palette may conflict with your default OS and browser keyboard shortcuts. You have the option to customize your keyboard shortcuts in the Accessibility section of your account settings. In the command palette settings, you can customize the keyboard shortcuts for opening the command palette in both search mode and command mode.

Navigating with the {% data variables.product.prodname_command_palette %}

You can use the command palette to navigate to any page that you have access to on {% data variables.product.product_name %}.

{% data reusables.command-palette.open-palette %}

  1. Start typing the path you want to navigate to. The suggestions in the command palette change to match your text.

{% data reusables.command-palette.change-scope %}

You can also use keystrokes to narrow your search. For more information, see "Keystroke functions."

  1. Finish entering the path, or use the arrow keys to highlight the path you want from the list of suggestions.

  2. Use Enter to jump to your chosen location. Alternatively, use Ctrl+Enter (Windows and Linux) or Command+Enter (Mac) to open the location in a new browser tab.

Searching with the {% data variables.product.prodname_command_palette %}

You can use the command palette to search for anything on {% data variables.product.prodname_dotcom %}.

{% data reusables.command-palette.open-palette %}

{% data reusables.command-palette.change-scope %}

  1. Optionally, use keystrokes to find specific types of resource:

    • # Search for issues, pull requests, discussions, and projects
    • ! Search for projects
    • @ Search for users, organizations, and repositories
    • / Search for files within a repository scope
  2. Begin entering your search terms. The command palette will offer you a range of suggested searches based on your search scope.

    {% tip %}

    You can also use the full syntax of {% data variables.product.prodname_dotcom %}'s integrated search within the command palette. For more information, see "AUTOTITLE."

    {% endtip %}

  3. Use the arrow keys to highlight the search result you want and use Enter to jump to your chosen location. Alternatively, use Ctrl+Enter (Windows and Linux) or Command+Enter (Mac) to open the location in a new browser tab.

Running commands from the {% data variables.product.prodname_command_palette %}

You can use the {% data variables.product.prodname_command_palette %} to run commands. For example, you can create a new repository or issue, or change your theme. When you run a command, the location for its action is determined by either the underlying page or the scope shown in the command palette.

  • Pull request and issue commands always run on the underlying page.
  • Higher-level commands, for example, repository commands, run in the scope shown in the command palette.

For a full list of supported commands, see "{% data variables.product.prodname_command_palette %} reference."

  1. The default keyboard shortcuts to open the command palette in command mode are Ctrl+Shift+K (Windows and Linux) or Command+Shift+K (Mac). If you already have the command palette open, press > to switch to command mode. {% data variables.product.prodname_dotcom %} suggests commands based on your location.

{% data reusables.command-palette.change-scope %}

  1. If the command you want is not displayed, check your scope then start entering the command name in the text box.

  2. Use the arrow keys to highlight the command you want and use Enter to run it.

Closing the command palette

When the command palette is active, you can use one of the following keyboard shortcuts to close the command palette:

  • Search and navigation mode: Esc or Ctrl+K (Windows and Linux) Command+K (Mac)
  • Command mode: Esc or Ctrl+Shift+K (Windows and Linux) Command+Shift+K (Mac)

If you have customized the command palette keyboard shortcuts in the Accessibility settings, your customized keyboard shortcuts will be used for both opening and closing the command palette.

{% data variables.product.prodname_command_palette %} reference

Keystroke functions

These keystrokes are available when the command palette is in navigation and search modes, that is, they are not available in command mode.

Keystroke Function
> Enter command mode. For more information, see "Running commands from the {% data variables.product.prodname_command_palette %}."
# Search for issues, pull requests, discussions, and projects. For more information, see "Searching with the {% data variables.product.prodname_command_palette %}."
@ Search for users, organizations, and repositories. For more information, see "Searching with the {% data variables.product.prodname_command_palette %}."
/ Search for files within a repository scope or repositories within an organization scope. For more information, see "Searching with the {% data variables.product.prodname_command_palette %}."
! Search just for projects. For more information, see "Searching with the {% data variables.product.prodname_command_palette %}."
Ctrl+C or Command+C Copy the search or navigation URL for the highlighted result to the clipboard.
Enter Jump to the highlighted result or run the highlighted command.
Ctrl+Enter or Command+Enter Open the highlighted search or navigation result in a new browser tab.
? Display help within the command palette.

Global commands

These commands are available from all scopes.

Command Behavior
Import repository Create a new repository by importing a project from another version control system. For more information, see "AUTOTITLE."
New gist Open a new gist. For more information, see "AUTOTITLE."
New organization Create a new organization. For more information, see "AUTOTITLE."
New project Create a new project. For more information, see "AUTOTITLE."
New repository Create a new repository from scratch. For more information, see "AUTOTITLE."
Switch theme to <theme name> Change directly to a different theme for the UI. For more information, see "AUTOTITLE."

Organization commands

These commands are available only within the scope of an organization.

Command Behavior
New team Create a new team in the current organization. For more information, see "AUTOTITLE."

Repository commands

Most of these commands are available only on the home page of the repository. If a command is also available on other pages, this is noted in the behavior column.

Command Behavior
Clone repository: <URL type> Copy the URL needed to clone the repository using {% data variables.product.prodname_cli %}, HTTPS, or SSH to the clipboard. For more information, see "AUTOTITLE."
New discussion Create a new discussion in the repository. For more information, see "AUTOTITLE."
New file Create a new file from any page in the repository. For more information, see "AUTOTITLE."
New issue Open a new issue from any page in the repository. For more information, see "AUTOTITLE."
Open in {% data variables.codespaces.serverless %} editor Open the current repository in the {% data variables.codespaces.serverless %} editor. For more information, see "AUTOTITLE."

File commands

These commands are available only when you open the command palette from a file in a repository.

Command Behavior
Copy permalink Create a link to the file that includes the current commit SHA and copy the link to the clipboard. For more information, see "AUTOTITLE."
Open in {% data variables.codespaces.serverless %} editor Open the currently displayed file in {% data variables.codespaces.serverless %} editor. For more information, see "AUTOTITLE."

Discussion commands

These commands are available only when you open the command palette from a discussion. They act on your current page and are not affected by the scope set in the command palette.

Command Behavior
Delete discussion... Permanently delete the discussion. For more information, see "AUTOTITLE."
Edit discussion body Open the main body of the discussion ready for editing.
Subscribe/unsubscribe Opt in or out of notifications for additions to the discussion. For more information, see "AUTOTITLE."
Transfer discussion... Move the discussion to a different repository. For more information, see "AUTOTITLE."

Issue commands

These commands are available only when you open the command palette from an issue. They act on your current page and are not affected by the scope set in the command palette.

Command Behavior
Close/reopen issue Close or reopen the current issue. For more information, see "AUTOTITLE."
Convert issue to discussion... Convert the current issue into a discussion. For more information, see "AUTOTITLE."
Delete issue... Delete the current issue. For more information, see "AUTOTITLE."
Edit issue body Open the main body of the issue ready for editing.
Edit issue title Open the title of the issue ready for editing.
Lock issue Limit new comments to users with write access to the repository. For more information, see "AUTOTITLE."
Pin/unpin issue Change whether or not the issue is shown in the pinned issues section for the repository. For more information, see "AUTOTITLE."
Subscribe/unsubscribe Opt in or out of notifications for changes to this issue. For more information, see "AUTOTITLE."
Transfer issue... Transfer the issue to another repository. For more information, see "AUTOTITLE."

Pull request commands

These commands are available only when you open the command palette from a pull request. They act on your current page and are not affected by the scope set in the command palette.

Command Behavior
Close/reopen pull request Close or reopen the current pull request. For more information, see "AUTOTITLE."
Convert to draft/Mark pull request as ready for review Change the state of the pull request to show it as ready, or not ready, for review. For more information, see "AUTOTITLE."
Copy current branch name Add the name of the head branch for the pull request to the clipboard.
Edit pull request body Open the main body of the pull request ready for editing.
Edit pull request title Open the title of the pull request ready for editing.
Subscribe/unsubscribe Opt in or out of notifications for changes to this pull request. For more information, see "AUTOTITLE."
Update current branch Update the head branch of the pull request with changes from the base branch. This is available only for pull requests that target the default branch of the repository. For more information, see "AUTOTITLE."