GitHub Shortcuts

Open Terminal app in MacOSX

cd MyProject
change directory to project folder

git init
initialize project

git status
check status of the git repo for working directory

git add .
git add file.txt

add all files or a specific file to staging area

git commit -m "This is a message"
commit staged files to repository (preferred method)
git commit -am "Update Comments"
skip staging area but is dangerous, adds all files to staging areas including ones you have opened but haven’t saved

git remote add Tulum https://.../repo.git
setup remote nickname for github project
git push -u Tulum master
remote is referenced here
git fetch -u https://.../repo.git master
git clone ...
git pull ...

git log
git log --author="Andrew"

git diff
git diff --staged

git rm file.txt
remove specified file
git mv file.txt newfile.txt
rename or copy contents of file.txt and paste it in newfile.txt

git checkout --index.html
git reset HEAD

git reset --soft 0ad5a7a6

Source: New Boston Git Tutorial


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s