This is for a quick demo of github!
change directory (switch folders)
-
cd
(drag folder from finder) -
cd ~/Desktop
list contents of current directory
-
ls -a
include hidden files -
ls -al
include hidden files in nice detailed list -
ls ~/Desktop
list the stuff on your desktop
where am I? (print working directory)
Basic Git Commands (git - the simple guide) explains this better than I can
download the whole repository at the given url
git clone https://github.com/amonks/ghd.git
start tracking a file
-
git add .
: add everything the current directory (.
) -
git add index.html
: add the index.html file only (equivalent togit add ./index.html
)
commit your changes into git, including a short message making note of what you changed
-
git commit -am "I changed many files"
automatically add anything that's changed (note the-a
) -
git commit -m "Here's a short description of stuff I changed"
commit any changes to files you've alreadygit add
ed
add a remote repository
git remote add origin https://github.com/amonks/ghd.git
create a remote calledorigin
from amonks'sghd
project on github. People usually call their main remoteorigin
for some reason.
publish your changes to a remote repository
-
git push origin master
. The default branch is calledmaster
. -
git push origin gh-pages
push to a branch calledgh-pages
pull changes from a remote repository
-
git pull origin master
get all the changes from themaster
branch at theorigin
remote -
git pull origin gh-pages
get all the changes from thegh-pages
branch at theorigin
remote