GitHub Copilot for CLI makes Terminal scripting and Git as easy as asking a question
Christian Heilmann
Posted on March 29, 2023
I just got access to GitHub Copilot CLI and a few seconds after installing it, I am happy as a clam about it.
You can see it in action in this video or let me talk you through it here. GitHub Copilot CLI brings AI code completion to your terminal. After installing it, you get three new commands:
-
??
: Translate natural language to arbitrary shell commands -
git?
: Translate natural language to Git commands -
gh?
: Translate natural language to GitHub CLI commands
I love using the Terminal, as it gives you a lot of power and it is a lot faster than other tools like Finder or Explorer. The issue is though that it is not easy to remember the sometimes cryptic syntax of bash commands and attributes of command line tools.
This is where Copilot CLI helps. Say you want to convert all the videos in the current folder to mp4 and resize them to 640 pixels width, keeping the aspect ratio. All you need to do is write ?? convert all videos in the folder to mp4 and resize them to 640px
hit enter. You get a suggestion of code that will do that task and a detailed, human readable explanation what the code does.
You can choose to run the command immediately, revise your input in case something feels off or cancel and go back to the terminal.
Another prompt I tried was ?? find all files bigger than 500mb and copy them to a folder called huge
and the result was immediate.
I like that it doesn't only give you the result, but also explains what the code does. This often is missing from answers on StackOverflow and other forums.
It will be interesting to see where this goes. The Terminal is a mighty tool and you can do a lot of damage if you are not aware of the consequences of your commands. It would be interesting to see Copilot also give you some safety instructions with every command it offers.
Posted on March 29, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 30, 2024