Git Workshop 03

Git Workshop 03

以 git remote 為主軸,搭配 GitHub 實作

481a04548eda340e5cf166b487792ee5?s=128

Li-Hsuan Chen

October 06, 2016
Tweet

Transcript

  1. (JU8PSLTIPQ 痧♲㔐  ꤫愴蠩

  2. 㥶卓⡹殹♴聃♶䥢 〳⟃꼛♳䩧倬䧮

  3. 㣐笧 ˖ 㔐瘸⵹♧妄㉏⽷涸㉏겗 ˖ (JU齡❉䢫欽涸匌銯 ˖ 3FNPUF㻜⡲ ˖ 倞㟞SFNPUF ˖

    ㄤSFNPUFSFQPTJUPSZ✽⹛ ˖ 3FNPUF✽⹛涸麕玑
  4. 㔐瘸㉏겗

  5. .FSHF5PPMT

  6. .FSHF5PPMT ˖ 㣖㢵DPOJDU  ˖ 〳腋僽ꨆ⚺箁㣖⛉ ˖ 䫵姊䧮鿪僽➃䊨鍑DPOJDU ˖ 〳⟃㢵㎲鑑♶ず涸NFSHFUPPMT

  7. 鼚⯝䘰鱲涸⾲㔔

  8. 鼚⯝䘰鱲涸⾲㔔 ˖ ⥃殆CSBODI涸暶䗚 ˖ 㺂僒鳺陏㥪鷆髠 ˖ 鼚⯝㔔捀䘰鱲㖈⚺銴ⴕ佅♳隶刿 ˖ 㕰꥙㼩倴CSBODI涸佟瘼

  9. 䗂⾲乽⡲

  10. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 git

    commit git add <files> git reset -- <files > git checkout -- <files>
  11. 3FTFU$IFDLPVU git reset git checkout 獵⹛)&"%⿮撑涸⡙縨 獵⹛CSBODI⿮撑涸⡙縨

  12. 佹㔐CSBODI ˖ 欽HJUSFPH䪪ⵌ鑪CSBODI剓䖕鄄DPNNJU涸⡙縨ⱄ䪾CSBODI⸈㔐齡 ⦐⡙縨♳ • $ git reflog • $

    git branch branchName [commit id] ˖ 殹㖈ⵅꤑCSBODI涸儘⦬剚㔐꺈DPNNJUJEㄤCSBODIOBNF窍⡹呏 亙鸏❉鎝䜂〳⟃䪾CSBODI⸈㔐⢵ • $ git branch -D master • Deleted branch master (was 130d7ba). • $ git branch master 130d7ba
  13. 䩧ꐫ䙦랃鳵

  14. 䩧ꐫ䙦랃鳵 ˖ 䩧ꐫDPNNJU鎝䜂 • git commit --amend -m "new message”

    ˖ 殹㛂遤鸏⦐䭸⟂涸儘⦬DPNNJUJE剚佖隶
  15. ⤑䰦涸䭸⟂

  16. ⤑䰦涸䭸⟂ ˖ "MJBTⴽそ • $ git config --global alias.st status

    • --global - 設定別名為使⽤用者 level • st - 別名的名稱 • status - 要被替代的指令 ˖ ⡙縨~/.gitconfig
  17. 醳绢♧♴

  18. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 劢鄄鷆髠涸墂呪

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪
  19. ⴕ佅 ˖ ⴕ佅涸劥颶僽⮭㶸DPNNJUJE涸墂呪⚛尝剤㶸ⴕ 佅♳䨾剤DPNNJU涸麕玑 ˖ 䒊用莅ざ⢘ⴕ佅 ˖ 䘰鱲涸⾲㔔ㄤ㥶⡦鼚⯝ ˖ ざ⢘儘涸遼瑳捀➊랃剚涮欰莅䙦랃鍑对

    ˖ 搂岁鍑对遼瑳儘꨾銴BCPSU鷎ⴀNFSHF朜䢀
  20. 鹎Ⰵ姻겗

  21. 齡❉䢫欽涸匌銯 ˖ NBTUFS殹䒊用SFQP儘涸갸鏤涸CSBODIそ珖 ˖ PSJHJO殹䒊用SFNPUF堥㐼儘涸갸鏤そ珖 ˖ 鸏❉鿪〳⟃鄄佖隶

  22. 3FNPUF

  23. 䖰劥㖒ⵌ黇畮

  24. h(JU5PXFS 䖰8PSLTIPQꟚ㨥ⵌ➛㣔⟃⵹䧮⦛鿪㖈劥㖒畮 ➛㣔䧮⦛㽠銴♳黇畮✫

  25. (JU)VC ˖ 44))5514 ˖ 44)黇畮剤Ⱇꚤ劥㖒畮剤猙ꚤ剤㼩䥰ⵌ㽠〳⟃ 鹎遤⫄鱒 ˖ )5514鷴麕)5514⫄鱒꨾銴䩛⹛鱒Ⰵ䌙贫㺙焺 ˖ 䧴欽(JU)VC䲿⣘涸㹐䨩畮

    ˖ IUUQTEFTLUPQHJUIVCDPN
  26. 䒊用倞㼠呪 ˖ ⵹䖃 ˖ IUUQTHJUIVCDPNOFX ˖ 倞㟞〭⨞HX涸㼠呪 ˖ ⚛䭾♴♴꬗涸$SFBUFSFQPTJUPSZ

  27. 鎹⡞鸏⦐笪㖧 〳⟃럊鸏鼹醳醢 鼇)5514

  28. 倞㟞SFNPUF⚛QVTI $ cd /to/your/path (略略) $ git remote add origin

    [remote URL] $ git push -u origin master // push 時可能需要輸入帳號密碼 ⯓⹛䩛⨞⨞溏 ⿡4PVSDF5SFFㄤ(JU)VC溏溏隶⻋
  29. 倞㟞SFNPUF⡙縨 ˖ remote鹎遤SFNPUF䭸⟂꧌涸ㄐ⟂ ˖ add倞㟞♧⦐SFNPUF⡙縨 ˖ originSFNPUF⡙縨涸そ珖〳⟃⟤䠑ㄐそ ˖ [remote URL]SFNPUF⡙縨涸63-

    $ git remote add origin [remote URL]
  30. None
  31. None
  32. None
  33. None
  34. None
  35. None
  36. None
  37. None
  38. None
  39. None
  40. None
  41. None
  42. None
  43. None
  44. None
  45. None
  46. None
  47. None
  48. None
  49. None
  50. None
  51. None
  52. None
  53. None
  54. None
  55. None
  56. None
  57. None
  58. None