プログラミング/git のバックアップソース(No.2)

更新

[[公開メモ]]

* 概要 [#x45859d7]

git についての備忘録的メモです。

* alias [#x821df63]

https://git.wiki.kernel.org/index.php/Aliases ここにも参考になる物がいっぱいある。

** git s [#bacfadbd]

 s = status

** git l, git la [#yf186d02]

 l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
 la = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

** git d [#kfb7cbb6]

履歴選択リスト付きの git diff

リストが表示された状態のまま Enter を押せば、普通に git diff と打ったのと同様に HEAD と working copy との間の差分をとる

履歴を1つ選んで Enter を押せば、その履歴と working copy との差分を取る

Ctrl+space で2つ選べば、その間の差分を取る

 d = !git diff --minimal --ignore-all-space `git log --oneline --branches | peco | ruby -e 'STDIN.readlines.reverse.each{|s| puts s[0..6]}'`

** git add-file [#v99e3026]

git add するファイルを一覧から選ぶ

 add-file = "!if [ \"`git status --porcelain | grep -E '^.[^ ]'`\" != \"\" ]; then git add `git status --porcelain | grep -E '^.[^ ]' | peco | sed -e 's/.* //'`; fi"

** git reset-file [#tf9d5f47]

git reset するファイルを一覧から選ぶ

 reset-file = "!if [ \"`git status --porcelain | grep -E '^[^\\? ]'`\" != \"\" ]; then git reset `git status --porcelain | grep -E '^[^\\? ]' | peco | sed -e 's/.* //'`; fi"

* コメント・質問 [#o5c9abb1]

#article_kcaptcha

Counter: 3939 (from 2010/06/03), today: 1, yesterday: 3