Skip to content

Instantly share code, notes, and snippets.

@ghaida
Last active November 30, 2015 20:06
Show Gist options
  • Select an option

  • Save ghaida/9a38ff0ba3edc0e13e36 to your computer and use it in GitHub Desktop.

Select an option

Save ghaida/9a38ff0ba3edc0e13e36 to your computer and use it in GitHub Desktop.
Git cheat sheet
________.______________
/ _____/| \__ ___/
/ \ ___| | | |
\ \_\ \ | | |
\______ /___| |____|
\/ cheat sheet
by @zoombear and @ghaidazahran
== COMMAND LINE
ls | List files in current directory
cd <FOLDER_NAME> | Change into FOLDER_NAME from current directory
cd ~/<FOLDER_NAME> | Change into FOLDER_NAME in your home directory
open . | Open current directory in finder
== BASICS
git clone URL | Download project files from GitHub
git status | Check to see what's changed
git add PATH | add PATH to a repo
git add . | Add all new/changed files to repo
git commit | Create snapshot (brings up editor to edit message)
git branch | See list of local branches and the currently active branch
git commit -m "MESSAGE" | Create snapshot with MESSAGE as message
git checkout -b BRANCH_NAME | Create BRANCH_NAME and change to that branch
git checkout BRANCH_NAME | Change to the BRANCH_NAME branch
git merge BRANCH_NAME | Merge changes from BRANCH_NAME into current branch
git push | Upload your commits to your repo/branch
git pull | Download new commits from your repo/branch
== TRICKS
git diffq | See changes your commits will make
git stash | Hide all your recent changes
git stash pop | Restore your recent changes
git reset head --hard | Undo all of the changes since your last commit
git log | See all commits in the history of the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment