履歴: プログラミング/git

各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 5 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます

日時タイトル文字数追加削除内容差分基準
2017/2/8 20:39:50プログラミング/git 最新版3,351+1 -1表示中差分—
2017/2/8 20:39:50プログラミング/git 3,357+33 -1表示差分選択
2017/2/8 11:39:50プログラミング/git 1,568+9 -0表示差分選択
2014/12/3 6:26:21プログラミング/git 1,331+10 -2表示差分選択
2014/12/3 5:06:36プログラミング/git 983— —表示—選択

2017/2/8 20:39:50 に書かれた内容 最新版

プログラミング/git


公開メモ

概要†

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

alias†

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

git s†

s = status

git l, git la†

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†

履歴選択リスト付きの 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†

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†

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

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

git tag-date†

git tag のリストに日付をつける

tag-date = "tag-date="for-each-ref --sort=-taggerdate --format='%(taggerdate:short) %(tag) %(taggername) %(subject)' refs/tags"

http://qiita.com/naoty_k/items/2b9d9560381bbe316818 より

現在の .gitocnfig†

[alias]
  s = status
  co = checkout
  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
  tag-date="for-each-ref --sort=-taggerdate --format='%(taggerdate:short) %(tag) %(taggername) %(subj                            ect)' refs/tags"
  # SYNTAX: git d
  #
  # 履歴一覧を表示して選択した履歴との 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.re                            adlines.reverse.each{|s| puts s[0..6]}'`

  # SYNTAX: git add-files
  #
  # git add するファイルを peco で選択する
  add-files= "!if [ \"`git status --porcelain | grep -E '^.[^ ]'`\" != \"\" ]; then git add `git stat                            us --porcelain | grep -E '^.[^ ]' | peco | sed -e 's/.* //'`; fi"

  # SYNTAX: git rm-files
  #
  # git rmするファイルを peco で選択する
  rm-files= "!if [ \"`git status --porcelain | grep -E '^.[^ ]'`\" != \"\" ]; then git rm `git status                             --porcelain | grep -E '^.[^ ]' | peco | sed -e 's/.* //'`; fi"

  # SYNTAX: git reset-files
  #
  # git reset するファイルを peco で選択する
  reset-files = "!if [ \"`git status --porcelain | grep -E '^[^\\? ]'`\" != \"\" ]; then git reset `g                            it status --porcelain | grep -E '^[^\\? ]' | peco | sed -e 's/.* //'`; fi"

コメント・質問†