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

さいきょうの.gitconfig

ama-ch
November 21, 2012

 さいきょうの.gitconfig

社内で開催された天下一.gitconfig大会の資料です。

スライド最後の参考URLはこちらにも貼っておきます。
ドットファイル(https://github.com/ama-ch/dotfiles)
oh-my-zshとhomesickを使ってdotfilesをGitHubで管理するようにした(http://ama-ch.hatenablog.com/entry/2012/09/23/201217)

ama-ch

November 21, 2012
Tweet

More Decks by ama-ch

Other Decks in Programming

Transcript

  1. ͍͖͞ΐ͏ͷ.gitconfig
    2012/11/20 ఱԼҰ.gitconfigେձ
    @ama_ch

    View full-size slide

  2. gitΛ࢖͏ͳΒආ͚ͯ
    ௨Εͳ͍.gitconfig

    View full-size slide

  3. Ͳ͏ͯ͠·͔͢ʁ
    • ࣗ෼ͰΰϦΰϦॻ͘
    • ਓͷΛ΋Β͏
    • άάͬͯίϐϖ

    View full-size slide

  4. ࠷ॳ͸ԿΛॻ͍ͨΒ
    ྑ͍͔෼͔Βͳ͍

    View full-size slide

  5. Web্ͷઃఆΛίϐ
    ϖ͗ͯ͢͠ΧΦε

    View full-size slide

  6. ࢖Θͳ͍ΤΠϦΞε
    ͕େྔ

    View full-size slide

  7. .gitconfigͷਏ͍ͱ͜Ζ
    • ͱ͖ͬͭʹ͍͘
    • ίϐϖͰԚΕΔ
    • ࣗ෼ͰΧελϚΠζ͢Δࠒʹ͸೺
    Ѳ͖͠Εͳ͍
    • ෳ਺ϚγϯͰڞ༗͍ͨ͠

    View full-size slide

  8. ϕετϓϥΫςΟε͕΄͍͠

    View full-size slide

  9. • .gitconfigͷϕετϓϥΫςΟεΛ୳ٻ͠
    ·ͨ͠

    View full-size slide

  10. • .gitconfigͷϕετϓϥΫςΟεΛ୳ٻ͠
    ·ͨ͠
    • ͳ͔ͥγΣϧ؀ڥΛશͯݟ௚͢͜ͱʹ
    ͳΓ·ͨ͠

    View full-size slide

  11. • .gitconfigͷϕετϓϥΫςΟεΛ୳ٻ͠
    ·ͨ͠
    • ͳ͔ͥγΣϧ؀ڥΛશͯݟ௚͢͜ͱʹ
    ͳΓ·ͨ͠
    • .gitconfig͸େͨ͠໰୊͡Όͳ͍ʂ

    View full-size slide

  12. • .gitconfigͷϕετϓϥΫςΟεΛ୳ٻ͠
    ·ͨ͠
    • ͳ͔ͥγΣϧ؀ڥΛશͯݟ௚͢͜ͱʹ
    ͳΓ·ͨ͠
    • .gitconfig͸େͨ͠໰୊͡Όͳ͍ʂ
    • ϕετγΣϧ؀ڥΛڞ༗͠·͢ʂ

    View full-size slide

  13. oh-my-zsh
    • zshͷϕετϓϥΫςΟεू
    • ๛෋ͳϓϥάΠϯ
    • ϦονͳPROMPTςʔϚ
    • gitͷϒϥϯνදࣔͱ͔΋Ͱ͖Δ
    • ϓϥάΠϯػߏͰಠࣗઃఆ΋

    View full-size slide

  14. ϦονͳPROMPT
    http://zshthem.es/

    View full-size slide

  15. ϓϥάΠϯػߏ
    .zshrc
    git.plugin.zsh
    ϩʔυ

    View full-size slide

  16. • ͨͩ͠oh-my-zshʹ.gitconfigͷઃఆ
    ͸ؚ·Εͳ͍
    • ࠷ॳͷ.gitconfig͸άάΔ͔νʔϜͰ
    ڞ༗͢Δ
    • ࠷ۙ͸ެ։ͯ͠Δਓ΋ଟ͍

    View full-size slide

  17. .gitconfigͱalias
    • .gitconfigʹalias͸جຊॻ͔ͳ͍
    • “git alias”͸௕͗͢Δ
    • alias͸γΣϧͰॻ͍ͨํ͕ศར
    • .gitconfig͸ิॿతͳ࢖͍ํʹཹΊΔ

    View full-size slide


  18. [alias]
    s = status --short --branch
    alias gs=‘git status --short --branch’
    $ git s
    $ gs

    View full-size slide

  19. γΣϧͰaliasΛॻ͘ϝϦοτ
    • ΑΓ୹໊͍લ͕͚ͭΒΕΔ
    • γΣϧεΫϦϓτΛఆٛͯ͠࢖͍
    ճͤΔ
    • ಡΈ΍͍͢
    • ෼ׂ͠΍͍͢

    View full-size slide

  20. Α͘࢖͏aliasᶃ
    gc => git commit -v
    gco => git checkout
    gba => git branch -a
    ga => git add
    gm => git merge

    View full-size slide

  21. Α͘࢖͏aliasᶄ
    gf => get fetch
    gup => git fetch && git rebase
    ggpush => git push origin $(current_branch)
    grh => git reset HEAD
    grhh => git reset HEAD --hard

    View full-size slide

  22. Α͘࢖͏aliasᶅ
    gl => git l => log --graph --(ུ)
    gd => git diff
    gdc => git diff --cached
    gr => git rebase

    View full-size slide

  23. Α͘࢖͏aliasᶆ
    gs => git status --status --branch
    gsd => gs + git diff
    gsa => gs + git add
    gsco => gs + git checkout
    gsrh => gs + git reset HEAD

    View full-size slide

  24. ͜͜·Ͱͷ·ͱΊ
    • .gitconfig͸ਓͷΛύΫΔ
    • oh-my-zshΛ࢖͏
    • oh-my-zshͷgitϓϥάΠϯΛ࢖͏
    • ϓϥάΠϯΛॻ͘
    • alias͸γΣϧʹॻ͘

    View full-size slide

  25. gitͱଧͬͨΒෛ͚

    View full-size slide

  26. dotfilesΛ؅ཧ͢Δ
    • dotfiles͸GitHubʹpush͓ͯ͘͠ͱ
    ଞͷϚγϯͰ΋࢖͍΍͍͢
    • homesickͱ͔࢖͏ͱίϚϯυҰൃ
    ͰಉظͰ͖Δ

    View full-size slide

  27. homesick
    • ೚ҙͷGitHubϦϙδτϦΛclone͠
    ͯɺϦϙδτϦʹؚ·ΕΔdotfiles
    ͷsymlinkΛ࡞੒͢ΔRubyGem
    • ߋ৽ͱ্͔ॻ͖ʹ΋ରԠ

    View full-size slide

  28. Πϯετʔϧ
    $ gem install homesick
    Ϋϩʔϯ
    $ homesick clone ama-ch/dotfiles
    γϯϘϦοΫϦϯΫ࡞੒
    $ homesick symlink ama-ch/dotfiles
    ߋ৽
    $ homesick pull ama-ch/dotfiles

    View full-size slide

  29. ·ͱΊ
    • .gitconfig͸ਓͷΛύΫΔ
    • oh-my-zshΛ࢖͏
    • ϓϥάΠϯΛॻ͘
    • dotfiles͸GitHubͰ؅ཧ͢Δ

    View full-size slide

  30. ࢀߟ
    υοτϑΝΠϧ(https://github.com/ama-ch/dotfiles)
    oh-my-zshͱhomesickΛ࢖ͬͯdotfilesΛGitHubͰ؅ཧ
    ͢ΔΑ͏ʹͨ͠(http://ama-ch.hatenablog.com/entry/
    2012/09/23/201217)

    View full-size slide

  31. ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View full-size slide