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

Git 九淺一深

JohnsonLu
January 23, 2015

Git 九淺一深

我佛你第 1 次 讀書會簡報

JohnsonLu

January 23, 2015
Tweet

More Decks by JohnsonLu

Other Decks in Education

Transcript

  1. • Introduction • Misuse • Commit Policy • Config •

    Branch • Tips • Rebase & Cherry-pick • Sub Module • Hooks • Multiple Remote
  2. • Separate subject from body with a blank line •

    Limit the subject line to 50 characters • Capitalize the subject line • Do not end the subject line with a period • Use the imperative mood in the subject line • Wrap the body at 72 characters • Use the body to explain what and why vs. how
  3. • git config --global user.name “JohnsonLu" • git config --global

    user.email [email protected] • git config --global core.editor vim • git config —list • git config --global push.default <matching or simple>
  4. • git branch #列出⺫⽬目前有多少branch • git branch -a #列出所有branch •

    git branch test-branch #產⽣生新的branch • git branch test-branch master #由master產⽣生新的branch • git branch -d test-branch #刪除branch • git branch -D test-branch #強制刪除branch • git checkout branch-name #切換到branch-name • git checkout master #切換到master • git checkout -b test-branch master #從master建⽴立新的branch,並同時切換過去 • git checkout <commit_hash> -b test #切換到某次commit並建⽴立新的branch
  5. • git tag -l #列出所有標籤 • git tag -a ver.1

    -m "First Version” • git show <tag> • git tag -a <tag> <commit-hash> #針對特定 commit做tag • git push <origin> —tags #push 所有tag
  6. • git submodule add <origin> <dir_name> • git submodule init

    #在.git/config 中加⼊入 submodule 設定 • git submodule update #把整個submodule clone 下來