Skip to content

Installing GitHub CLI and Adding Useful Aliases

Installing GitHub CLI

  1. Open a terminal and follow the instructions for your operating system:

    For macOS:

    sh
    brew install gh

    For Windows:

    sh
    winget install --id GitHub.cli

    For Linux:

    sh
    sudo apt install gh
  2. Authenticate GitHub CLI with your GitHub account:

    sh
    gh auth login

Adding Useful Git Aliases

  1. Open your Git configuration file:

    sh
    nano ~/.gitconfig
  2. Add the following aliases to enhance your Git productivity:

    ini
    [alias]
        co = checkout
        br = branch
        ci = commit
        st = status
        lg = log --oneline --graph --decorate --all
        last = log -1 HEAD
        unstage = reset HEAD --
        amend = commit --amend --no-edit

Adding Useful GitHub CLI Aliases

  1. Open your GitHub CLI configuration file:

    sh
    nano ~/.config/gh/config.yml
  2. Add the following aliases to enhance your GitHub CLI productivity:

    yaml
    aliases:
      pr: pull-request
      prc: pr create
      prl: pr list
      prr: pr review
      prmr: pr merge
      isu: issue
      isuc: issue create
      isul: issue list

By following these steps, you can install GitHub CLI and add useful aliases to both Git and GitHub CLI, enhancing your productivity and streamlining your workflow.