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 https://github.com/mfadtparis/CreativityAndComputation.git

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 .
or
$ 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

Links
http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1
https://github.com/
http://git-scm.com/

Leave a reply

Skip to toolbar