DEV Community

Cover image for A printable, PDF - Git cheatsheet

Posted on • Updated on

A printable, PDF - Git cheatsheet

Hello guys,

instead of a new article, I'd like to share two printable cheatsheets with you.

I hope you'll find these useful.

Cheatsheet 1: Common Git commands for local development

The first cheatsheet shows a common development workflow when working on a development project. Among these are:

  • How to initialize a Git repository
  • How to add and remove files from the Git repos
  • How to manage code changes over several new features

Git cheatsheet one

Get the PDF from my Git repos:

Cheatsheet 2: Remote Git Servers

The second cheatsheet shows you a common, distributed development pattern and visualizes how several maintainers work on the same codebase.

It attempts to answer the questions about:

  • How does a pull request work?
  • How are local and remote repositories synchronized?
  • How to delete a remote branch?

Image description

Get the PDF from my Git repos:

Update 19.03.2022: Add new layout for Cheatsheet I

Top comments (8)

roneo profile image • Edited

Great work!
At step 4.) the names 'stash' and 'stage' are used to speak about the same thing

tqbit profile image

Hi Reneo,

thanks for pointing it out, I've corrected the same in the img & pdf.

tanishqsinghanand profile image
Tanishq Singh Anand

OP 🔥🔥

kirankamath96 profile image
Kiran Kamath

In cheatsheet 2 , developer 1 and developer 1(local), does the local means a new branch?

tqbit profile image

Hi Kiran.

  • The local repos is the clone of the remote one
  • The light-green dots are a local branch (feature that is not reflected on remote)
  • The dark-green is the main branch of dev 1
azlan_syed profile image


kurtdegreeff profile image
Kurt De Greeff

Could you please explain what the difference is between Origin and Upstream?
It is also not clear to me what the colors of all the dots stand for.. Thanks

tqbit profile image
tq-bit • Edited

Hi Kurt.

Origin and Upstream are naming conventions when working with remote repositories

It's common to push to origin and pull from upstream

  • Imagine you are dev 1
  • Then you would register your fork as the 'origin'
git add origin
git commit -m 'my commit'
git push origin
Enter fullscreen mode Exit fullscreen mode
  • And you would register the owners repos as 'upstream' to pull down changes
git add upstream 
git stash
git pull upstream
git stash pop
Enter fullscreen mode Exit fullscreen mode

Regarding the dots - each color represents a separate repos/branch combination

E.g. for the owner repos

  • Dot 1 (red): owner/my_code/master
  • Dot 2 (green): pull request from dev_1/my_code/feature to owner/my_code/master
  • Dit 3 (red): owner/my_code/master