Skip to content

Instantly share code, notes, and snippets.

@airbornelamb
Created October 20, 2017 14:42
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 airbornelamb/815628d5f625ef160682ff990b18c838 to your computer and use it in GitHub Desktop.
Save airbornelamb/815628d5f625ef160682ff990b18c838 to your computer and use it in GitHub Desktop.
Git cheat sheet

Clone a repo

git clone https://github.com/cooperka/emoji-commit-messages.git

Or initialize a repository locally

git init

Stage local changes

git add --all

Commit local changes with a message

git commit -m “Add myFile.txt”

Upload local changes to server

git push origin HEAD

Download changes from the server

git pull origin master

Sample workflow

git clone https://github.com/cooperka/emoji-commit-messages.git
cd emoji-commit-messages
git status
git checkout -b my-new-feature
echo “This is a cool new file” > myFile.txt
git status
git add --all
git status
git diff HEAD
git commit -m “Add myFile.txt”
git status
git log
git push origin HEAD
git checkout master
git pull
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment