Skip to content

Instantly share code, notes, and snippets.

@rezanid
Last active November 18, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezanid/2b81ca65dd3f31ac5ff044b08df72102 to your computer and use it in GitHub Desktop.
Save rezanid/2b81ca65dd3f31ac5ff044b08df72102 to your computer and use it in GitHub Desktop.
Git Cheat Sheet

When you have one remote

Commands can be shorter when you have only one remote Git server.

Fetch

git fetch

Checkout

git checkout name-of-the-remote-branch

Example output:
Branch 'test-branch' set up to track remote branch 'test-branch' from 'origin'.

When you have more than one branch

Commands need to be more explicit when you have more than one remote Git server.

Fetch

git fetch origin This will fetch all of the remote branches.

See the list of available branches

git branch -v -a

Checkout

git checkout -b test <name of origin>/test Shorter: git checkout -t <name of remote>/test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment