The ultimate GitHub cheat sheet to work with your team at lightning speed

19 April 2021

Shiping Pull Request on GitHub at lightning speed
Photo by lachlangowen

In my previous article, we saw how I use Zsh shortcuts with git. It working great if you are alone on your project. But if you want to be effective in a team, you will need to have a workflow around GitHub.

gh is GitHub on the command line. It brings pull requests, issues, and other GitHub concepts to the terminal next to where you are already working with git and your code.

Installation on macOS

You can install the CLI tool with brew if you are on macOS or from other sources.

brew install gh

When it's done you need to authenticate with your GitHub account.

gh auth login

Getting started

If you already used git init and pushed your code, you can clone a repository or preview it on a webpage.

gh repo clone user/repo_name
gh repo view --web

Create a new branch

Working as a team, you need to branch out your work from the main (or master) branch. With gco -b you can checkout and create a new branch at the same time.

gco -b feature/new-stuff

Create a pull request

Work and manage pull requests from the terminal.

gh pr create
gh pr view --web

Browse all the commands on the official documentation.

Bonus: change the previous commit

Sometimes you forgot to push something or you want to edit your previous commit.

gc! 	git commit -v --amend
gca! git commit -v -a --amend
gcan! git commit -v -a --no-edit --amend

Gravatar for dleuliette@gmail.com

Hi, I’m David, a french freelance developer working remotely. I’m the author of this blog, nice to meet you!

Subscribe?

Be the first to receive insightful articles and actionable resources that help you to elevate your skills across every touch point.