Tuesday 21 May 2013

Git : Quick Reference


If you're new to git follow this to get up and running in a min:

set up a new repository: git clone repository_url

(code... code... code...)
 
check pending changes: git status -s

add files to the changeset: git add .
Notes:
1) not restricted to new files only; all files including existing modified ones need to be explicitly added before being commited
2) The dot in the end is part of it, not a typo. It just makes it recursively add all changed files from this dir and its subdirs

committing to the local repo: git commit -m "a message"
 
pull latest code from remote repository: git pull

(merge... merge... merge...)

push to the remote repository : git push

voila!

a few other ones that may be helpful: 

check what branch you're on: git branch

switch to a different branch: git checkout branch_name

happy git!

No comments:

Post a Comment