gitThursday, May 23, 13
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 ...
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 c...
Thursday, May 23, 13
GIT DEMOgit	  config	  -­‐-­‐global	  user.name	  "Adam	  Bray”git	  config	  -­‐-­‐global	  user.email	  "adam.bray@yale....
GIT DEMO#	  setup	  vagrantcd	  ~/path/to/your/codemkdir	  assignment3vagrant	  init	  railsvagrant	  upvagrant	  sshThurs...
GIT DEMO#	  change	  dir	  to	  shared	  foldercd	  /vagrant	  mkdir	  git-­‐demogit	  initgit	  statusThursday, May 23, 13
GIT DEMOtouch	  hello.rbsubl	  .git	  statusgit	  add	  hello.rbgit	  commit	  -­‐m	  “created	  hello	  program”git	  sta...
GIT DEMOtouch	  bye.rbgit	  statusgit	  add	  bye.rbgit	  commit	  -­‐m	  “added	  bye	  program”git	  statusgit	  logThur...
githubThursday, May 23, 13
Thursday, May 23, 13
CREATING A REPO ON GITHUB•Login to github.com•create a repository called git-demo•follow instructions under “Push an exist...
COMMON GITHUB WORKFLOW#make	  some	  changes	  to	  filesgit	  statusgit	  add	  .git	  commit	  -­‐m	  “description	  of	...
CLONING A REPOTo	  download	  a	  repo	  for	  the	  first	  time,	  use:git	  clone	  https://github.com/intro-­‐to-­‐rai...
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...
Upcoming SlideShare
Loading in …5
×

Git and Github

363 views

Published on

Introduction to git and github for YEI / STC Tech Bootcamp Summer 2013

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
363
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Git and Github

  1. 1. gitThursday, May 23, 13
  2. 2. and why learn it first?what is git?Thursday, May 23, 13
  3. 3. GIT HELPS US...•track & undo changes (manage versions)•collaborate on projects•share code with othersThursday, May 23, 13
  4. 4. 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
  5. 5. 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
  6. 6. Thursday, May 23, 13
  7. 7. GIT DEMOgit  config  -­‐-­‐global  user.name  "Adam  Bray”git  config  -­‐-­‐global  user.email  "adam.bray@yale.edu”Thursday, May 23, 13
  8. 8. GIT DEMO#  setup  vagrantcd  ~/path/to/your/codemkdir  assignment3vagrant  init  railsvagrant  upvagrant  sshThursday, May 23, 13
  9. 9. GIT DEMO#  change  dir  to  shared  foldercd  /vagrant  mkdir  git-­‐demogit  initgit  statusThursday, May 23, 13
  10. 10. GIT DEMOtouch  hello.rbsubl  .git  statusgit  add  hello.rbgit  commit  -­‐m  “created  hello  program”git  statusgit  logThursday, May 23, 13
  11. 11. GIT DEMOtouch  bye.rbgit  statusgit  add  bye.rbgit  commit  -­‐m  “added  bye  program”git  statusgit  logThursday, May 23, 13
  12. 12. githubThursday, May 23, 13
  13. 13. Thursday, May 23, 13
  14. 14. 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
  15. 15. 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
  16. 16. 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
  17. 17. TIPS•Commit often•Commits should contain only related changes•Don’t commit half-baked featuresThursday, May 23, 13
  18. 18. 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

×