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

穿越時空的版本控制 Git

穿越時空的版本控制 Git

Git: The Version Control Which Leapt Through the Time. 2014/10/31 Talk @ NTU Open Source Community, Taipei, Taiwan.

Poren Chiang

October 31, 2014
Tweet

More Decks by Poren Chiang

Other Decks in Technology

Transcript

  1. 瑭馊儘瑠涸
    晝劥䱾ⵖ
    34$IJBOH㩎厣⟤
    $$#:4"
    (JU
    /5604$荩㣐Ꟛ彂爢

    View full-size slide

  2. ⵹縨⡲噠

    View full-size slide

  3. ⵌㆭ酭䪪(JU
    ˖ 㥶卓ꨶ舡♳鼩尝剤涸鑨ĈĈ
    ˖ 8JOEPXT(JUGPS8JOEPXT N4ZT(JU

    ˖ 0499DPEFㄐ⟂⴪䊨Ⱘ
    ˖ -JOVY apt-getFUD UIPVHIVOMJLFMZ

    View full-size slide

  4. 㛇劥须鎝
    HJUDPOHHMPCBMVTFSOBNF4IVJZVBO%JBP
    HJUDPOHHMPCBMVTFSFNBJMOUVUSVDL!HNBJMDPN
    剐䳖䧭⡹涸そ㶶騈䢫欽⥌盳

    鸏僽(JU欽⢵陏ⴽ⡹涸倰䒭

    View full-size slide

  5. ♧⴪盘

    View full-size slide

  6. HJUJOJU
    ˖ 㖈湡⵹涸须俲㣰㾝Ꟛ"5⸂㜥晝劥䱾ⵖ
    ˖ 㛇劥欽岁cd <湡ꏗ> && git init
    ˖ 鹎ꥣ欽岁git init <湡ꏗ>
    ˖ 㛂遤痧✳妄剚涮欰♶㥪涸✲

    View full-size slide

  7. ✳䮋鼇墂呪

    View full-size slide

  8. HJUBEE
    ˖ 䪾墂呪⸈鹎(JU盘椚涸眕㕠酭
    ˖ 䧴僽䪾⥜佖䖕涸墂呪秝Ⰵ晝䱾眕㕠⚥
    ˖ ♧菛铃岁git add <墂呪䧴须俲㣰>
    ˖ 阌䢆⢪欽git add .

    View full-size slide

  9. HJUSN
    ˖ 䖰晝劥䱾ⵖ䏨騈须俲㣰ず儘ⵅꤑ墂呪
    ˖ ♧菛欽岁git rm <墂呪>
    ˖ 㥶卓♶䋞劆墂呪劥넓鄄獵ꤑ〳⟃欽--cached

    View full-size slide

  10. ♲娝墂

    View full-size slide

  11. HJUTUBUVT
    ˖ 溏溏湡⵹涸䞕屣
    ˖ 剚ⴕ䧭չ䊺鼇《涸墂呪պչ劢鼇《涸墂呪պ

    չ㼿劢⸈鹎晝劥䱾ⵖ涸墂呪պ

    View full-size slide

  12. HJUDPNNJU
    ˖ 㼟湡⵹鼇涸墂呪娝墂䧭♧⦐DPNNJU晝劥
    ˖ 剚䩧Ꟛ禺窡갸鏤涸管鱀㐼鱒ⰅDPNNJUNFTTBHF
    ˖ ♧菛欽岁git commit
    ˖ ♧遤⨞㸤git commit -m "<鎝䜂>"

    View full-size slide

  13. HJUMPH
    ˖ 增鋕䊺竤DPNNJU涸晝劥鎹ꏗ
    ˖ ♧菛欽岁git log
    ˖ 㥪隡晝git log --oneline --graph

    View full-size slide

  14. 㔋㔐彸晝劥

    View full-size slide

  15. #SBODI
    晝劥埠
    HJUDIFDLPVU
    HJUSFTFU
    植㖈晝劥

    View full-size slide

  16. HJUDIFDLPVU
    ˖ 䖰晝劥鎹ꏗ⚥隡ⴀ俒⟝
    ˖ 㔐ⵌ麕⿡git checkout <晝劥>
    ˖ 鼩⾲暶㹁墂呪git checkout <晝劥> -- <墂呪>

    View full-size slide

  17. HJUSFTFU
    ˖ 儘꟦⦝鱲ⴗ䳖⚆歲箁涸ⵄ㐼
    ˖ 㔐鷎♧⦐晝劥git reset HEAD^
    ˖ 㔐鷎ⵌ厥♧儘꟦git reset
    HEAD@{2days}
    倞晝劥
    莍晝劥

    View full-size slide

  18. ❀佞♳ꨣ畮

    View full-size slide

  19. HJUSFNPUF
    ˖ 鏤㹁黇畮鸮箁须鎝
    ˖ 鸒䌢〫剚欽ⵌ♴꬗鸏♧遤

    git remote add <そ珖> <騟䖜>

    View full-size slide

  20. HJUQVTI
    ˖ 㼟ꨶ舡♳涸晝劥埠䲀ⵌ黇畮
    ˖ 痧♧妄㛂遤git push origin master -u
    ˖ 莅黇畮䒊用ꡠ耢⛓䖕㽠〳⟃湬䱺欽git push✫

    View full-size slide

  21. HJUDMPOF
    ˖ 䖰黇畮䪾厥⦐晝劥䱾ⵖ䏨䭡頺♴⢵
    ˖ ♧菛欽岁git clone <笪㖧> [须俲㣰そ珖]
    ˖ 〳⟃僽须俲㣰笪㖧䧴僽44)湡ꏗ

    View full-size slide

  22. 眕⢿(JU)VC

    View full-size slide

  23. ♴妄爢铭
    劍⚥罌鹋
    馜䘰㔐⿡㈥剅ゅ s〡A

    !
    劍⚥罌䖕痧♧妄爢铭
    㖒럊崞㣐
    !
    湱ꡠ须鎝剚佞㖈)BDLQBE莅爢㕰

    View full-size slide

  24. 2VFTUJPOT
    34$IJBOH
    $$#:4"
    /5604$荩㣐Ꟛ彂爢

    View full-size slide