Skip to content

Instantly share code, notes, and snippets.

@teppeis
Last active April 29, 2023 14:58

Revisions

  1. teppeis revised this gist Jun 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    ui = auto
    [push]
    # push only the current branch
    default = tracking
    default = current
    [branch]
    autosetuprebase = always
    [merge]
  2. teppeis revised this gist Nov 21, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の[@teppeis](http://twitter.com/teppeis)の資料です。

    ぎっとぎとにしてやんよ
    ====

    天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の[@teppeis](http://twitter.com/teppeis)の資料です。

    ![DojoCat](http://octodex.github.com/images/dojocat.jpg)

    ## [GistDeck](https://github.com/nzoschke/gistdeck)
  3. teppeis revised this gist Nov 21, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ぎっとぎとにしてやんよ
    ====

    天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の[@teppeis](https://github.com/teppeis)の資料です。
    天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の[@teppeis](http://twitter.com/teppeis)の資料です。

    ![DojoCat](http://octodex.github.com/images/dojocat.jpg)

  4. teppeis revised this gist Nov 21, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    ぎっとぎとにしてやんよ
    ====

    天下一gitconfig大会(サイボウズ社内git勉強会@2012/11/20)の[@teppeis](https://github.com/teppeis)の資料です。

    ![DojoCat](http://octodex.github.com/images/dojocat.jpg)

    ## [GistDeck](https://github.com/nzoschke/gistdeck)
    @@ -266,4 +268,4 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA

    ## Thanks!

    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)
    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)
  5. teppeis revised this gist Nov 21, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -43,6 +43,8 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    669
    ```

    参考: [http://shokai.org/blog/archives/6186](http://shokai.org/blog/archives/6186)

    ## .gitconfig

    ```
    @@ -127,7 +129,7 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA

    ## .gitignore

    オレオレgitignoreがくっそ便利。svnではできなかった。
    オレオレgitignoreがくっそ便利。<del>svnではできなかった。</del>svnでも指定できたみたいです。[コメ欄参照](https://gist.github.com/4117588#gistcomment-603892) thanks! @thinca

    * repo/.gitignore : 特定リポジトリで全メンバー共有
    * repo/.git/info/exclude : 特定リポジトリで自分だけ
    @@ -265,4 +267,3 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    ## Thanks!

    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)

  6. teppeis revised this gist Nov 21, 2012. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -55,6 +55,7 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    excludesfile = ~/.gitignore
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    editor = vi
    [color]
    ui = auto
    [push]
    @@ -147,7 +148,6 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    [core]
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    [config]
    editor = vi
    [color]
    ui = auto
    @@ -264,4 +264,5 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA

    ## Thanks!

    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)
    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)

  7. teppeis revised this gist Nov 21, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -147,6 +147,8 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    [core]
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    [config]
    editor = vi
    [color]
    ui = auto
    ```
  8. @ymmt2005 ymmt2005 revised this gist Nov 20, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -147,6 +147,8 @@ javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setA
    [core]
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    [config]
    editor = vi
    [color]
    ui = auto
    ```
  9. teppeis created this gist Nov 20, 2012.
    265 changes: 265 additions & 0 deletions tenkaichi-git.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,265 @@
    ぎっとぎとにしてやんよ
    ====

    ![DojoCat](http://octodex.github.com/images/dojocat.jpg)

    ## [GistDeck](https://github.com/nzoschke/gistdeck)

    * gistでmarkdown書いたらbookmarkletでプレゼンになるよ。
    * ↓これをBookmarkに登録してこのページで実行してみよー!
    ```
    javascript:(function()%7Bvar%20s%3Ddocument.createElement(%27script%27)%3Bs.setAttribute(%27src%27,%27https://raw.github.com/teppeis/gistdeck/fix/gistdeck.js%27)%3Bdocument.getElementsByTagName(%27head%27)%5B0%5D.appendChild(s)%3B%7D)()%3B
    ```
    * 複数行のcodeとかが微妙なのでスタイル修正してます。
    * いろいろ微妙なのでたぶんもう使わないw
    * Confluenceで作ったら便利かもね。

    ## gitコマンドランキング(自分調べ)

    ![Nyantocat](http://octodex.github.com/images/nyantocat.gif)

    ```
    46834 s
    11945 l
    9471 co
    6758 d
    5657 add
    5238 fs
    4591 ci
    4505 f
    3640 pull
    3074 b
    2499 stash
    2163 show
    2161 push
    2105 ln
    1963 submodule
    1379 dc
    1274 st
    1254 rebase
    1132 rebase -i
    762 push -u
    735 help
    669
    ```

    ## .gitconfig

    ```
    [user]
    name = teppeis
    email = [email protected]
    [include]
    path = .gitconfig.local
    [core]
    excludesfile = ~/.gitignore
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    [color]
    ui = auto
    [push]
    # push only the current branch
    default = tracking
    [branch]
    autosetuprebase = always
    [merge]
    # from 1.7.6
    ff = false
    [pull]
    # from 1.7.9
    rebase = true
    [alias]
    # http://oli.jp/2012/git-powerup/
    # http://blog.blindgaenger.net/advanced_git_aliases.html
    alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
    b = branch -a
    br = browse-remote
    ci = commit
    co = checkout
    d = diff
    dc = diff --cached
    di = diff
    dic = diff --cached
    f = fetch --prune
    fs = !git f && git su
    ignore = !([ ! -e .gitignore ] && touch .gitignore) | echo $1 >> .gitignore
    info = remote show origin
    l = log --graph -n 20 --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(green)- %an, %cr%Creset'
    ll = log --stat --abbrev-commit
    ln = log --graph -n 20 --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(green)- %an, %cr%Creset' --name-status
    lp = log --oneline -n 20 -p
    ls = log --stat --abbrev-commit -n 1 # display previous log
    s = status --short --branch
    st = status
    su = submodule update
    # git-browse-remote
    # http://subtech.g.hatena.ne.jp/motemen/20120917/1347889804
    [web]
    browser = google-chrome
    [browse-remote "github.com"]
    top = https://{host}/{path}
    ref = https://{host}/{path}/tree/{short_ref}
    rev = https://{host}/{path}/commit/{commit}
    [browse-remote "github.dev.cybozu.co.jp"]
    top = https://{host}/{path}
    ref = https://{host}/{path}/tree/{short_ref}
    rev = https://{host}/{path}/commit/{commit}
    [browse-remote "git.dev.cybozu.co.jp"]
    top = http://{host}/graph/{path[1]}
    ref = http://{host}/changelog/~br={short_ref}/{path[1]}
    rev = http://{host}/changelog/{path[1]}?cs={commit}
    [browse-remote "review.dev.cybozu.co.jp"]
    top = http://{host}/graph/{path[1]}
    ref = http://{host}/changelog/~br={short_ref}/{path[1]}
    rev = http://{host}/changelog/{path[1]}?cs={commit}
    ```

    ## [include]

    ないしょの鍵とかトークンとかを別ファイルで保存できるよ(git 1.7.10から)。

    ```
    [include]
    path = .gitconfig.local
    ```

    ## .gitignore

    オレオレgitignoreがくっそ便利。svnではできなかった。

    * repo/.gitignore : 特定リポジトリで全メンバー共有
    * repo/.git/info/exclude : 特定リポジトリで自分だけ
    * core.excludesfile : 全リポジトリで自分だけ

    ```
    [core]
    excludesfile = ~/.gitignore
    ```

    ## GitHub直伝 gitignoreコレクション

    [https://github.com/github/gitignore](https://github.com/github/gitignore)

    ## 基本的なところ

    ```
    [core]
    # http://stackoverflow.com/questions/136178/git-diff-handling-long-lines
    pager = less -r
    [color]
    ui = auto
    ```

    ## push & rebase & merge

    ```
    [push]
    # push only the current branch
    default = tracking
    [branch]
    autosetuprebase = always
    [merge]
    # from 1.7.6
    ff = false
    [pull]
    # from 1.7.9
    rebase = true
    ```

    ## 余談

    * いまググると「gitではmerge --no-ff, pull --rebaseをデフォルトにできない」っていう昔の記事がたくさんひっかかるけど、できるようになってるよ。
    * man git-config するといいよ。

    ## alias

    このリンクがオススメ

    * [http://oli.jp/2012/git-powerup/](http://oli.jp/2012/git-powerup/)
    * [http://blog.blindgaenger.net/advanced_git_aliases.html](http://blog.blindgaenger.net/advanced_git_aliases.html)

    ```
    [alias]
    alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\\t => \\2/' | sort
    b = branch -a
    br = browse-remote
    ci = commit
    co = checkout
    d = diff
    dc = diff --cached
    di = diff
    dic = diff --cached
    f = fetch --prune
    fs = !git f && git su
    ignore = !([ ! -e .gitignore ] && touch .gitignore) | echo $1 >> .gitignore
    info = remote show origin
    l = log --graph -n 20 --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(green)- %an, %cr%Creset'
    ll = log --stat --abbrev-commit
    ln = log --graph -n 20 --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(green)- %an, %cr%Creset' --name-status
    lp = log --oneline -n 20 -p
    ls = log --stat --abbrev-commit -n 1 # display previous log
    s = status --short --branch
    st = status
    su = submodule update
    ```

    ## ログフォーマット

    * git help logしたらフォーマットの意味が分かるよ。
    * 個人的にはauthor date (%a系) よりもcommitter date (%c系) が好きです。

    ## git-browse-remote

    * コマンドラインから現在のブランチのgithubページとかをブラウザで一発で開ける神ツール。
    * 本当に神ツール。
    * [http://subtech.g.hatena.ne.jp/motemen/20120917/1347889804](http://subtech.g.hatena.ne.jp/motemen/20120917/1347889804)

    ## この設定で勝つる!

    ```
    [web]
    browser = google-chrome
    [browse-remote "github.com"]
    top = https://{host}/{path}
    ref = https://{host}/{path}/tree/{short_ref}
    rev = https://{host}/{path}/commit/{commit}
    [browse-remote "github.dev.cybozu.co.jp"]
    top = https://{host}/{path}
    ref = https://{host}/{path}/tree/{short_ref}
    rev = https://{host}/{path}/commit/{commit}
    [browse-remote "git.dev.cybozu.co.jp"]
    top = http://{host}/graph/{path[1]}
    ref = http://{host}/changelog/~br={short_ref}/{path[1]}
    rev = http://{host}/changelog/{path[1]}?cs={commit}
    [browse-remote "review.dev.cybozu.co.jp"]
    top = http://{host}/graph/{path[1]}
    ref = http://{host}/changelog/~br={short_ref}/{path[1]}
    rev = http://{host}/changelog/{path[1]}?cs={commit}
    ```

    # おまちかね

    ## 声に出して読みたい地獄のミサワ

    ![ターン!](http://jigokuno.img.jugem.jp/20100218_1708335.gif)

    * [Githubで使える地獄のミサワまとめ](http://matome.naver.jp/odai/2134910435868769101)
    * [MISAWA::MD](https://chrome.google.com/webstore/detail/misawamd/legplkhbgdelfceignhcchogkmoflagl)

    ## 本物のソーシャルコーディングを教えてやる

    ![lolcommits](http://mroth.github.com/lolcommits/assets/img/sample/sample3.jpeg)

    * [lolcommits](http://mroth.github.com/lolcommits/)
    * さーせん、ローカルのMacでは動きませんでした。。

    ## その他おもしろい&そうなやつら

    * fugitive.vim
    * tig
    * hug & GitHub API (特にNotification)

    ## Thanks!

    ![ChelloCat](http://octodex.github.com/images/chellocat.jpg)