Today I got access to the GitHub Copilot CLI beta and thought I would write a short post based on my initial experience.
Note: This is based on my first day using the tool and I likely will write a further post as I learn more about the tool to help people get the most out of it
One of the first things I was surprised about was how incredibly simple it was to install the Copilot CLI. I don’t know what I was expecting but I was up and running within minutes.
The first step is to install GitHub Copilot CLI globally on your machine using
npm install -g @githubnext/github-copilot-cli
The next step is to authenticate with GitHub which is achieved by running the following command:
You are then given some on-screen instructions, which include visiting a page on github.com and entering an authorisation code. In all very easy to authenticate.
Finally, to enable the command shortcuts you need to run
eval "$(github-copilot-cli alias -- "$0")"
And that is is, the CLI is now fully integrated and you are now ready to use Copilot on the CLI.
With GitHub Copilot installed in my CLI, I can now use it to help me write commands by using the
?? alias along with a query. A simple example being
?? list all the folders with their file size ordered by created date
This will then figure out the best command to run and explain the different parts of the command so you know what the command will do if you choose to execute it. You can then choose to either run the command, revise it or cancel.
If I run the command, it will then display the results as if I ran the command myself; also add it to my CLI history so I can run it again in the future if necessary.