GitHub Copilot for CLI makes Terminal scripting and Git as easy as asking a question

codepo8

Christian Heilmann

Posted on March 29, 2023

GitHub Copilot for CLI makes Terminal scripting and Git as easy as asking a question

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.

screenshot of the terminal with the answer by copilot and a 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.

Finding big files in a folder and moving them to a dedicated folder as explained by CoPilot

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.

💖 💪 🙅 🚩
codepo8
Christian Heilmann

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