GitHub Copilot CLI: AI for the Command-Line


May 26, 2023

Reading time
2 min read

📹 The above video demonstraits the GitHub Copilot CLI in the terminal.


The project isn't yet open to all, but you can sign-up to be on the waiting list.

Once you get access, you can install the @githubnext/github-copilot-cli module from npm. There are instructions on how to install and use the module there as well.

npm install -g @githubnext/github-copilot-cli
github-copilot-cli auth

You'll also want to add the following snippet to your ~/.zshrc file (or associated startup config) and then source it (or create a new termianl tab).

eval "$(github-copilot-cli alias -- "$0")"


git? specific command

The git? command is specific when you want to generate a command that is related to git.

Here are some examples that I showed from the video...

git? how do i update the message of my last commited
git? i accidentally commited to main, but it needs to be in a branch
replace new-feature with feature-awesome OR branch is feature-awesome
git? how to delete branch locally and on origin
for the feature-awesome branch

gh? specific command

The gh? command is specific when you want to interact with the GitHub gh command-line tool.

Here are some examples that I showed from the video...

gh? list prs
that were created by me
gh? how to i list my public gists and pipe those through fzf with a preview of each gist
edit the gist that is selected
put the preview on the bottom

?? generic command

The ?? command is a generic command that helps you generate any other command that you might want.

Here are some examples that I showed from the video...

?? list global npm packages
?? list top level folders from ~/.config
only show the name


The tool registers the commands with your shell's history, so you can pull back up previous commands using your shell!

Works in Any Terminal Emulator

A nice thing about this tool is that it doesn't require you to use a particular terminal emulator. You can use it in whatever emulator you like best!

Web Mentions

Tweet about this post and have it show up here!