p:: CLI f:: GitHub Copilot

GitHub - cli/cli: GitHub’s official command line tool

brew install gh

Using GitHub Copilot in the command line

Installing GitHub Copilot in the CLI - GitHub Docs

gh extension install github/gh-copilot

Configuring GitHub Copilot in the CLI - GitHub Docs

echo 'eval "$(gh copilot alias -- zsh)"' >> ~/.zshrc
source ~/.zshrc

Getting command explanations

ghce "sudo apt-get"
Welcome to GitHub Copilot in the CLI!
version 1.0.5 (2024-09-12)
 
I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency
 
Explanation:
 
  • sudo is used to run a command with elevated rights.
  • apt-get is the Ubuntu package manager command-line tool.
 

Getting command suggestions

ghcs "Undo the last commit"
Welcome to GitHub Copilot in the CLI!
version 1.0.5 (2024-09-12)
 
I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparency
 
Suggestion:
 
  git reset --hard HEAD~1
 
? Select an option  [Use arrows to move, type to filter]
> Copy command to clipboard
  Explain command
  Execute command
  Revise command
  Rate response
  Exit