Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Git

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.
Avatar for Colin Su Colin Su
December 19, 2011

Introduction to Git

Introduction to Git on the TA session of OOP course.
National Chengchi University - LittleQ

Avatar for Colin Su

Colin Su

December 19, 2011
Tweet

More Decks by Colin Su

Other Decks in Technology

Transcript

  1. Git Introduction Version Control System Who am I • LittleQ,

    a senior student of NCCUCS • Software engineer of Genie Capital • Co-organizer of Taipei-GTUG • Instructor of Geego system, Inc • http://about.me/littleq • Python, Linux and everything geeky! Monday, December 19, 11
  2. Git Introduction Version Control System What is Git • Version

    control system • Coding history • Distributed version control Monday, December 19, 11
  3. Git Introduction Version Control System Version True False commit  296fad37b4e3e78bd952d419625d87f52a3d52d4

    Merge:  e5fb1da  fe68f70 Author:  Jacob  Thornton  <[email protected]> Date:      Thu  Nov  24  11:13:33  2011  -­‐0800        新增一行很重要的code,把bug給修好了! commit  fe68f708ce723cef640c1cf784cb29da513bca22 Author:  Martin  Bean  <[email protected]> Date:      Thu  Nov  24  19:06:00  2011  +0000        樓上對不起!我不小心把你code給砍了=  = Warcraft I Warcraft II Warcraft III Starcraft I Starcraft II Monday, December 19, 11
  4. Git Introduction Version Control System Why Git • Maintenance •

    Debug • Responsibility Monday, December 19, 11
  5. Git Introduction Version Control System History • Developed by Linus

    Torvalds • Born for improving the development of Linux Kernel Monday, December 19, 11
  6. Git Introduction Version Control System Who need Git • Real

    Engineer • Engineers who is working with thousands of thousands of lines of code • Wanna being a contributor of open source projects Monday, December 19, 11
  7. Git Introduction Version Control System Steps • Install Git •

    Setup Git • Initialize your rst local repository • Commit, commit and commit! Monday, December 19, 11
  8. Git Introduction Version Control System Install Git • In Linux,

    it is just a piece of cake • In Windows, google it Monday, December 19, 11
  9. Git Introduction Version Control System Setup Git • Username git

    con g --global user.name “LittleQ” • Email git con g --global user.email “<email>” Monday, December 19, 11
  10. Git Introduction Version Control System Repo init • Get into

    your project’s root directory • `git init` • `git add .` • `git commit -m “ rst commit”` Monday, December 19, 11
  11. Git Introduction Version Control System Commit • the basic unit

    of modi ed records • changes can be on single le or multiple les • can be deleting les or adding les Monday, December 19, 11
  12. Git Introduction Version Control System Make a commit • Make

    the modi cations • `git status` • `git add <modi ed- les>` • `git commit -m “message”` Monday, December 19, 11
  13. Git Introduction Version Control System Push & Pull • Push:

    send your modi cations to the server • Pull: receive the modi cations from others • `git pull` • `git push origin master` Monday, December 19, 11
  14. Git Introduction Version Control System Clone a Repo • git

    clone <git-repo-url> Monday, December 19, 11
  15. Git Introduction Version Control System Github • A social website

    of engineers (Enginner version Facebook) • Easy to manage your git repo • Socialize your work Monday, December 19, 11
  16. Git Introduction Version Control System Exercise • Here we are

    going to create a repo and build a simple Hello World program on it • We won’t do much programming stuff, so please concentrate • Now pick up 3 members (Included yourself) to form a group Monday, December 19, 11
  17. Git Introduction Version Control System Sign Up • Just go

    to sign up an account on Github • Find out the pro le page of your teammates and follow them on github • Choose one as the leader and the one need to create a repo and add others members as the repo members Monday, December 19, 11
  18. Git Introduction Version Control System Create a Repo and Push

    to Server • mkdir teamXX; cd teamXX; • git init • git remote add origin <url-of-repo> • git add . • git commit -m “ rst commit” • git push origin master Monday, December 19, 11
  19. Git Introduction Version Control System Prototype of HW #  comments

    #  teamXX #  99XXXXXX,  99XXXXXX,  99XXXXXX function  hello1()  { print(“hello,  member1’s  name”); } function  hello2()  { print(“hello,  member2’s  name”); } function  hello3()  {    print(“hello,  member2’s  name”); } function  main()  {    hello1();    hello2();    hello3(); } Monday, December 19, 11
  20. Git Introduction Version Control System Notice • Each function can

    only be completed by one and different from others • Need to push onto github • If someone got stuck, help each other Monday, December 19, 11
  21. Git Introduction Version Control System Resource • Git http://git-scm.com/ •

    Github help http://help.github.com/ • iHower blog http://ihower.tw/blog/posts > Git category Monday, December 19, 11