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

03 May 2023

Shiping Pull Request on GitHub at lightning speed
Photo by lachlangowen

I am releasing a book about the React Native ecosystem, which covers everything I wish I had known before I started working with this technology.

If you appreciate my work and would like to show your support, please check the Road to React Native.

In my previous article, we saw how I use Zsh shortcuts with git. It works 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

Open project in Github

Open your current GitHub homepage project in a web browser.

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.

# Create a new branch, and switch to it
gcb feature/new-stuff

Create a pull request

Work and manage pull requests from the terminal.

# Create a new pull request on GitHub
gh pr create

# Launch your web browser
gh pr view --web

Push your files

Push your files to Github from the terminal.

# View your files status
gss

# Add all your modifications
gaa

# Commit with a message
gcmsg 'message'

# Push your modification
gp

Browse all the commands on the official documentation.

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.