Your SlideShare is downloading. ×
Git and Github
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Git and Github

209
views

Published on

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

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
209
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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