refspec matches more than oneとか言われたとき
$ git push origin hoge
error: src refspec hoge matches more than one.
error: failed to push some refs to '<git place>'
I was trying to push to a canonical repository this morning and got the following error:
$ git push origin master
error: src refspec master matches more than one.
error: failed to push some refs to 'ssh://user@host/srv/git/repo'
This happened because I had accidentally created a master tag locally:
$ git tag
master
tag1
tag2
tag3
tag4
Once I deleted the tag locally:
$ git tag -d master
I was able to push again.
つまり、ブランチ名と同じ名前のタグがあるせいでgitコマンドを打っても、gitがそれがタグを指しているのかブランチを指しているのかわからないので、止まってしまう。
tagを消せば解決するよ。。。ってこと。
特定のファイルのみの履歴を追いかけたい
$ git log --follow -p <filename>
もしくは
$ git log -p <filename>
ブランチ名変更
$ git branch -m [<old-branch>] <new-branch>
ブランチ名を<old-branch>から<new-branch>に変更
グラフィカルに出すよ
$ git log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
CSVファイルのような、差分を確認しづらいファイルの場合
$ git diff --word-diff
これで、単語単位での差分をチェックできる
$ git diff --word-diff-regex="[^[:blank:],]"
このようにすることで、単語の区切り文字を定義した差分チェックができる。
上記の場合はスペースとカンマ。
べんりリンク
最終更新:2013年05月30日 16:12