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

Git Workshop 02

Git Workshop 02

Li-Hsuan Chen

September 29, 2016
Tweet

More Decks by Li-Hsuan Chen

Other Decks in Programming

Transcript

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

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪
  2. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 劢鄄鷆髠涸墂呪

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪 $ git init
  3. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 劢鄄鷆髠涸墂呪

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪 $ touch a.txt
  4. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 劢鄄鷆髠涸墂呪

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪 $ git add a.txt
  5. (JU涸♲⦐ꥣ媯 8PSLJOH%JSFDUPSZ 䊨⡲湡ꏗ 4UBHF *OEFY  程䒸⼦ -PDBM3FQPTJUPSZ 劥㖒⮭㶸䏨 劢鄄鷆髠涸墂呪

    佞㖈TUBHF涸墂呪隶刿 䩞〳⟃鄄⸈Ⰵ晝劥䱾ⵖ 鄄晝劥䱾ⵖ涸墂呪 $ git commit -m “add a.txt”
  6. 倞㟞CSBODI⚛DPNNJU $ cd /to/your/path $ git init $ touch a.txt

    $ git add a.txt $ git commit -m “add a.txt” $ git branch my-branch $ git checkout my-branch $ touch b.txt $ git add b.txt $ git commit -m “add b.txt” ⯓⹛䩛⨞⨞溏 㖈麕玑⚥欽4PVSDF5SFF溏溏䧭卓
  7. 倞㟞CSBODI⚛DPNNJU $ cd /to/your/path $ git init $ touch a.txt

    $ git add a.txt $ git commit -m “add a.txt” $ git checkout -b my-branch $ touch b.txt $ git add b.txt $ git commit -m “add b.txt”
  8. ざ⢘CSBODI … (前略略) $ git checkout master $ git merge

    my-branch ⯓⹛䩛⨞⨞溏 㖈麕玑⚥欽4PVSDF5SFF溏溏䧭卓
  9. 遼瑳鍑对㸤䧭䖕 ˖ 鍑对㸤䧭儘䗳갭DPNNJU • git add . // ઌ೺໨㑚Ճೖ stage

    • git commit // ࣥߦ commit ˖ 岤䠑搂岁鍑对儘䗳갭銴鷎ⴀNFSHF垸䒭 • git merge --abort ˖ 岤䠑剤㼠呪墂䚍颶涸㼠呪䗳갭銴增叆僽や〳管陼麕ㄤ齅鱀姻焷䩞 腋鹎遤NFSHFDPNNJU <<<<< ===== >>>>>
  10. 湡⵹捀姺涸䭸⟂ • git init • git add <filename> • git

    commit -m “message” • git branch <branch name> • git checkout <branch name> • git checkout -b <branch name> • git merge <branch name> • git merge --no-ff <branch name> • git merge --abort • git diff <commit id 1> <commit id 2>