Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git in a nutshell

20,724 views

Published on

粗略介紹 Git 的用法,以及一些在 Windows 跟 Mac 底下的工具

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download Full doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download PDF EBOOK here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download EPUB Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... Download doc Ebook here { http://shorturl.at/mzUV6 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... ,DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ,DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/yxufevpm } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y3nhqquc } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Git in a nutshell

  1. 1. Git 是什麼? What is Git?
  2. 2. Git 是什麼git[git]n.飯桶﹐無用的人
  3. 3. 版本控制系統™  多人協同開發 ™  每個人開發一個小功能™  改錯了還有救 ™  可回溯到之前版本 ™  可知道是誰改爛的
  4. 4. 源起™  Linus Torvalds (Linux 的作者)™  為了管理 Linux Kernel 程式碼而開發
  5. 5. 採用 Git 的專案™  Android ™  jQuery™  Linux Kernel ™  Perl™  Debian, Fedora, openSUSE ™  Qt™  Git ™  Ruby on Rails™  Gnome ™  VLC™  GIMP ™  Wine™  GTK+ ™  X.org Server ™  x264
  6. 6. Git 的好處 Why Git is better than Xhttp://zh-tw.whygitisbetterthanx.com/
  7. 7. 優於其他管理系統
  8. 8. 本機管理系統
  9. 9. 本機管理系統
  10. 10. 中央管理系統 (CVCS)
  11. 11. 中央管理系統 (CVCS)
  12. 12. 分散管理系統 (DVCS)
  13. 13. 分散管理系統 (DVCS)
  14. 14. 沒有網路也能工作™  Git once, coding anywhere!™  Branch 開不用錢™  看 log 超快
  15. 15. 適合超大量資料™  操作速度超快™  儲存的檔案很小™  連 Linux Kernel 都 hold 得住
  16. 16. Branch 不用錢™  開 branch 幾乎零成本™  開 branch 改東西,不怕改爛主軸™  切換 branch 很簡單™  Git 的 merge 很聰明
  17. 17. Git 的運作概觀 Git overview
  18. 18. 關於版本The Others’ Way
  19. 19. 關於版本The Git’s Way
  20. 20. Git 是這樣看待 commit 的
  21. 21. Git 是這樣看待 commit 的
  22. 22. 一些用語™  HEAD ™  指出目前位於哪個節點™  origin ™  預設的原始 repo 名稱™  master ™  預設的 branch 名稱™  bare repo ™  分享的 repo,習慣以 ProjName.git 命名
  23. 23. 支援協定™  file:// ™  本機檔案,例如用 Dropbox 架 repo™  ssh:// ™  安全,適合寫入™  git:// ™  效率好,但沒有認證機制,適合唯讀™  http:// or https:// ™  簡單,效率低,可突破防火牆
  24. 24. 忽略規則™  空目錄會被忽略 ™  習慣放個 .gitkeep 在裡頭避免忽略™  用 .gitignore 排除不需要的檔案 ™  https://github.com/github/gitignore ™  放在 Working tree 的根目錄 ™  記得也要 commit ™  能自動產生的東西都該排除 ™  全域設定放在 ~/.gitignore
  25. 25. Git 常用指令 Git commands
  26. 26. git config™  使用者資訊,commit 時會用到 ™  git config --global user.name “Your Name” ™  git config --global user.email “account@mail.address”
  27. 27. git config™  讓終端機顯示上色 ™  git config --global color.ui true
  28. 28. git config™  For Linux & Mac ™  git config --global core.autocrlf input ™  git config --global core.safecrlf true™  For Windows ™  git config --global core.autocrlf true ™  git config --global core.safecrlf true
  29. 29. git init™  初始化 repo™  建立 bare repo ™  git init --bare
  30. 30. git add™  將新檔案加入追蹤™  將修改過的檔案加入 stage™  git add . ™  將所有檔案加入追蹤 ™  常接在 git init 之後
  31. 31. git commit™  提交 stage 裡的資料™  git commit -m “Commit message”
  32. 32. git clone™  複製一份 repo™  從 bare repo 複製 ™  git clone protocol://path/to/bare_repo.git™  從現有 repo 建立 bare repo ™  git clone --bare <dir_name> <bare_dir_name>.git
  33. 33. git status™  檢視目前狀態
  34. 34. git branch™  列出或建立 branch™  git branch <branch_name>™  branch name 強烈建議用 [0-9A-Za-z_-.]
  35. 35. git tag™  列出或建立 tag™  tag name 強烈建議用 [0-9A-Za-z_-.]
  36. 36. git tag (cont.)™  建立 tag ™  git tag <tag_name> ™  git push --tags™  移除 tag ™  git tag -d <tag_name> ™  git push origin :refs/tags/<tag_name>
  37. 37. git checkout™  切換到其他 branch™  git checkout -b <branch_name> = git branch <branch_name> + git checkout <branch_name>
  38. 38. git stash™  保存目前的工作環境™  git stash apply --index <stash_name> ™  將保存的環境倒回來,包含 stage 的內容
  39. 39. git reset™  重置 stage 的狀態™  git reset HEAD <file_name> ™  重置單一檔案™  git reset HEAD ™  重置所有檔案™  git reset --hard HEAD ™  連 working tree 也重置
  40. 40. git revert™  取消上個 commit™  git revert HEAD ™  會建立一個新 commit
  41. 41. git fetch™  將本機 repo 與遠端 repo 同步
  42. 42. git pull™  將本機 repo 與遠端 repo 同步,並更新 working tree™  git pull = git fetch + git merge
  43. 43. git push™  推送本機 repo 資料到遠端 repo
  44. 44. git merge™  合併資料到當前 branch
  45. 45. Git 工作流程 Work with Git
  46. 46. 工作流程ref. http://progit.org/book/ch5-1.html
  47. 47. Centralized Workflow 中央控管 適合小型團隊
  48. 48. Integration-Manager Workflow 整合式管理員 適合網路多人協同專案,例如 GitHub.com
  49. 49. Dictator and Lieutenants Workflow 司令官與副手 適合超大專案,例如 Linux Kernel
  50. 50. 分支模型ref. http://nvie.com/posts/a-successful-git-branching-model/
  51. 51. master™  一直存在的分支™  記錄每個上線的版本™  只有在推出新版時才會變動™  所謂的穩定版(stable version)
  52. 52. develop™  一直存在的分支™  必須總是 build 得過™  new feature 跟 enhancement 都在這裡™  所謂的測試版(beta version)
  53. 53. feature™  從 develop 分支出來™  要 merge 回 develop™  新增或修改功能時才會出現™  功能完成就砍掉
  54. 54. release™  從 develop 分支出來™  要 merge 回 master,並且上 tag™  要 merge 回 develop™  管理者決定要 release 新版時才會建立™  release 之後就砍掉™  修改版本號、Release Note、ReadMe™  最後測試並修正測試發現的 bug
  55. 55. hotfix™  從 master 分支出來™  要 merge 回 master,並且上 tag™  要 merge 回 develop 或 release™  緊急修正問題專用™  修正之後就砍掉™  修改版本號、Release Note、ReadMe
  56. 56. 總結™  不同 branch 有不同用途,不得混用™  任何更動都要開 branch™  除了 master 跟 develop 之外,完成任務就砍掉 branch
  57. 57. 建議工作規範 My proposal
  58. 58. 時常同步™  每天或每週一次™  有備份才安心™  習慣 Git 的操作™  降低 merge 困難度
  59. 59. 愛用 branch™  開 branch 不用錢,所以任何變動都開 branch™  不要在 master 或 develop 修改程式
  60. 60. 詳細 commit™  記得移除行尾空白™  一次只 commit 一個主題™  commit message 寫清楚 ™  第一行:主旨,少於 50 字元 ™  第二行:空白 ™  第三行:詳情,每行少於 74 字元
  61. 61. 關於檔案™  避免不同平台產生亂碼 ™  檔名只能用 ASCII 字元 ™  檔名不得使用可能非法字元,如 / ? < > * : | ” ™  文字檔編碼一律用 UTF-8™  避免不同軟體產生亂碼 ™  文字檔內容一律用 ASCII 字元(即:不得用中文)
  62. 62. Git 工具Git on Windows & Mac
  63. 63. 安裝 Git™  Mac ™  http://code.google.com/p/git-osx-installer/™  Windows ™  http://code.google.com/p/msysgit/
  64. 64. 跨平台工具
  65. 65. 工程師的浪漫
  66. 66. Mac
  67. 67. SourceTree (Git/Hg)http://itunes.apple.com/us/app/sourcetree-git-hg/id411678673?mt=12
  68. 68. GitX (L)http://gitx.laullon.com/
  69. 69. Windows
  70. 70. TortoiseGithttp://code.google.com/p/tortoisegit/
  71. 71. SmartGit http://www.syntevo.com/smartgit/index.htmlCross-platform, free for non-commercial purpose.
  72. 72. EGit for Eclipse http://eclipse.org/egit/
  73. 73. Git 參考資料 Git references
  74. 74. ™  簡介 ™  http://git-scm.com/ ™  http://speakerdeck.com/u/dannvix/p/20111214-git-in- a-nutshell ™  http://www.slideshare.net/littlebtc/git-5528339™  教學 ™  http://progit.org/ ™  http://marklodato.github.com/visual-git-guide/index- en.html ™  http://ihower.tw/blog/archives/category/git
  75. 75. ™  其他 ™  http://nvie.com/posts/a-successful-git-branching- model/ ™  https://github.com/github/gitignore ™  http://zh-tw.whygitisbetterthanx.com/ ™  http://people.debian.org.tw/~chihchun/2008/12/19/ linus-torvalds-on-git/
  76. 76. 你問,我…盡量答 Q&A

×