and why learn it first?what is git?Thursday, May 23, 13
GIT HELPS US...•track & undo changes (manage versions)•collaborate on projects•share code with othersThursday, May 23, 13
HOW DOES IT WORK?•we create a git repository for a given project• this is a folder containing the project, and its entire history• the history is stored as snapshots (called commits)•the folder generally contains the latest version• this is called the working directory•we interact with git using the git commandThursday, May 23, 13
HOW DOES IT WORK?•git only tracks the files we tell it to• to track a file, we use git add filename•each time we want to create a ‘savepoint’, we create acommit•git only commits the changes we tell it to• to add a modified file to a commit, use git add filename• this adds changes to the staging area•to create a commit, use git commit -m “commit message”Thursday, May 23, 13
CREATING A REPO ON GITHUB•Login to github.com•create a repository called git-demo•follow instructions under “Push an existingrepository from the command line”Thursday, May 23, 13
COMMON GITHUB WORKFLOW#make some changes to filesgit statusgit add .git commit -‐m “description of changes”#make more changes and repeatgit pull #check for conflictsgit push #send changes to githubThursday, May 23, 13
CLONING A REPOTo download a repo for the first time, use:git clone https://github.com/intro-‐to-‐rails-‐course-‐yale/git-‐demo.gitThursday, May 23, 13
TIPS•Commit often•Commits should contain only related changes•Don’t commit half-baked featuresThursday, May 23, 13
SUMMARY•git init #create a git repo•git add filename #add file(s) to be committed•git commit -m “message” #create a commit (savepoint)•git pull / git push #get / send changes to github•git status #check status of repo•git log #look at commit historyThursday, May 23, 13
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.