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

Use Git to Control Your Life

Use Git to Control Your Life

五倍紅寶石 Git 課程「人生不能重來,但 Git 可以」投影片

高見龍

July 24, 2016
Tweet

More Decks by 高見龍

Other Decks in Technology

Transcript

  1. photo by Eddie 傈劥3VCZ钢阮Ꟛ涮罏   "EPCF⾲䑖钢阮'MBTIꟚ涮罏   -JOVY-1*㕜ꥹ钢阮

      ❀⦔秋㼂瀖Ⱏずⶾ鳵➃ 〵抓8FC$POG1)1$POG涮饱➃ 3BJMT(JSMT5BJQFJ涮饱➃ 155'MBTI晝晝⚺ a.k.a Eddie 넞鋅륌 !FEEJFLBP
  2. (JU

  3. Mac: $ brew install git Ubuntu or some linux OS:

    $ sudo apt-get install git-core or  $ sudo apt-get install git
  4. 䒊用湡ꏗ $ mkdir demo ⴲ㨥⻋ $ cd demo $ git

    init Initialized empty Git repository in / private/tmp/demo/.git/
  5. 叆溏朜䢀 $ git status Initial commit Changes to be committed:

    (use "git rm --cached <file>..." to unstage) new file: index.html
  6. 䲿❜ $ git commit -m "add index.html" [master (root-commit) cb96971]

    add index.html 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 index.html
  7. ♶䟝欽갸鏤涸管鱀㐼  emacs: $ git config --global core.editor emacs
 sublime

    text: $ git config --global core.editor "subl -n -w" atom: $ git config --global core.editor "atom --wait"
  8. 雊湡⵹涸湡ꏗ㔐ⵌ♳♧妄涸DPNNJU $ git checkout . $ git clean -f $

    git clean -df # d = 清除⺫⽬目錄 幢ꤑVOUSBDL朜䢀涸墂呪
  9. 倞㟞ⴕ佅DBU $ git branch cat 增鋕ⴕ佅 $ git branch cat

    * master $ git branch -D cat Deleted branch cat (was cb96971). ⵅꤑⴕ佅DBU
  10. ⥜佖䲿❜ $ git rebase -i cb96971 # p, pick =

    use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell
  11. ♳⫄ $ git push origin master $ git push origin

    cat ♳⫄DBUⴕ佅ⵌPSJHJO眏럊
  12. ざ⢘厥⦐暶㹁眏럊 $ git cherry-pick 823520ed $ git cherry-pick 823520ed --edit

    ざ⢘厥⦐暶㹁眏럊⵹管鱀鎝䜂 $ git cherry-pick 823520ed --no-commit 《䖤厥⦐暶㹁眏럊Ⰹ㺂⡎♶鹎遤ざ⢘
  13. TUFQ倞㟞⾲⢵SFQP涸黇畮眏럊 $ git remote add upstream ORIGIN_REPO $ git fetch

    upstream TUFQ《䖤鑪眏럊墂呪 $ git merge upstream/master TUFQざ⢘
  14. on Mac: $ brew install git-flow on Ubuntu or some

    linux OS: $ sudo apt-get install git-flow IUUQTHJUIVCDPNOWJFHJUPXXJLJ*OTUBMMBUJPO
  15. 倞㟞GFBUVSFTJHO@VQ $ git flow feature start sign_up $ git flow

    feature finish sign_up 㸤䧭GFBUVSFTJHO@VQ