Git/Github Cheat Sheet

Typical git commands:
clone – gets a copy of a remote repository locally
pull – get changes of a remote repository to update local version
add – add changes to stage so included in next commit (needed for new files)
commit – take a snapshot of current changes in local repository
push – send local commits (changes) to remote repository

Get a github repository using Terminal and save it locally:
$ git clone

Update local git repository with remote version on github:
$ git pull

Add new files to local git (use when you create or put new files in git folder)
$ git add .
$ git add myDirectory

Take a snapshot of the current state of a local repository:
$ git commit -m “first commit”

Update remote version of repository from local version (push your changes):
$ git push
or (if more than one branch)
$ git push origin master

Show current changes
$ git status

To get out of merge (vim) screen:
esc : wq

Typical steps for working with git:
$ cd myLocalDirectoryPath
$ git pull
$ git add myFileOrDirectory
$ git commit -m “message explaining changes”
$ git push


Leave a reply

Skip to toolbar