Git basic

684 views
631 views

Published on

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
684
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Git basic

  1. 1. Git Basic<br />Browny<br />2010.12.06<br />
  2. 2. Outline<br />Version Control System (VCS)<br />Introduction to Git<br />Install Git<br />Basic Commands<br />Git Branch<br />Resources<br />
  3. 3. rcs<br />
  4. 4. Centralized Version Control System (CVCS)<br /><ul><li> CVS
  5. 5. Subversion
  6. 6. Perforce
  7. 7. etc…</li></li></ul><li>Distributed Version Control System (DVCS)<br /><ul><li>Git
  8. 8. Mercurial
  9. 9. Bazaar
  10. 10. etc…</li></li></ul><li>Snapshot, not Differences<br />CVS<br />Git<br />
  11. 11. Flow<br />
  12. 12. Install Git on Windows<br />msysgit - http://code.google.com/p/msysgit/<br />
  13. 13. Initialization<br />設定 ID 和 Email<br /> $ gitconfig --global user.name “browny" <br /> $ gitconfig --global user.emailbrowny@gmail.com<br />查看設定資料<br /> $ gitconfig --list<br />
  14. 14. Basic Commands (1)<br />初始化一個 git倉庫<br />$ git init<br />將檔案放入暫存夾等候 commit<br />$ git add<br />指定要忽略 commit 的檔案 (create a file in your repo named .gitignore)<br />*.[oa]:忽略所有 .o 和 .a 檔案<br />*~ :忽略所有 ~ 檔案<br />
  15. 15. Basic Commands (2)<br />觀看狀態<br />$ git status<br />提交 <br />$ git commit<br />幫某次 commit 加上含附註的標籤 tag<br />$ git tag –a v1.1 –m ‘version 1.1’<br />觀看提交歷程<br />$ git log<br />
  16. 16. Basic Commands (3)<br />複製遠端 repo.<br />$ git clone git://github.com/schacon/grit.git<br />自定義複製來的 repo. 名稱<br />$ git clone git://github.com/schacon/grit.git mygrit<br />
  17. 17. First Commit<br />
  18. 18. Multiple Commit<br />
  19. 19. master<br />
  20. 20. Make a branch<br />$ git branch testing<br />
  21. 21. Re-direct HEAD<br />$ gitcheckout testing<br />
  22. 22. Commit on testing<br />
  23. 23. Back to master<br />$ gitcheckout master<br />
  24. 24. Commit on master<br />
  25. 25. Basic Commands (4)<br />查看現有的分支<br /> $ gitbranch               <br />建立新的分支<br /> $ gitbranch 分支名稱<br />切換到主幹上<br /> $ gitcheckout master <br />切換到某個分支上<br />gitcheckout 分支名稱<br />
  26. 26.
  27. 27. Resources<br />Git - http://git-scm.com/<br />Pro Git簡體翻譯 - http://progit.org/book/zh/<br />Git初學文件整理 | Tsung'sBlog - http://plog.longwin.com.tw/my_note-unix/2009/05/14/git-learn-initial-document-2009<br />

×