git notesを使うと、コミットログとは別に個人的なメモなどを残しておくことができる。
github 上のリポジトリで notes を共有するための設定。
git clone https://github.com/kskmori/git-practice
cd git-practice
git config --add remote.origin.fetch +refs/notes/*:refs/notes/*
git config --add remote.origin.push +refs/notes/*:refs/notes/*
notes をつけてみる。
こんな感じで git log で表示される。
git push すると github 上でも commit ページで表示される。
これだけでも使えるが、問題は複数の人でnotesをいじる場合、 merge と同じように conflict の問題が発生する。こういう場合は namespace を分けてnotes をつけるとよい。
git notes --ref backport-1.0 add -m "TEST NOTES 2 in namespace" HEAD
git log -1 --show-notes=*
commit 223073803bca6d54e2d4b6cbab596cb10368e6ad
Author: (...)
Date: Thu Jun 21 14:27:11 2012 +0900
test for Notes
Notes:
TEST NOTES
Notes (backport-1.0):
TEST NOTES 2 in namespace
常に同じnamespaceを使う場合は GIT_NOTES_REF 環境変数を設定すればよい。namespaceを指定しない場合のデフォルトは commits という namespace である。
export GIT_NOTES_REF=refs/notes/backport-1.0
上記 git config の設定ではpush/pull時にすべての notes も一緒に同期する。不要であれば毎回手動で指定する方法でも可能。この辺は tag の指定と同じ。
参考リンク
http://git-scm.com/2010/08/25/notes.html
github 上のリポジトリで notes を共有するための設定。
git clone https://github.com/kskmori/git-practice
cd git-practice
git config --add remote.origin.fetch +refs/notes/*:refs/notes/*
git config --add remote.origin.push +refs/notes/*:refs/notes/*
notes をつけてみる。
git notes add -m "TEST NOTES" HEAD
git log HEAD
commit 223073803bca6d54e2d4b6cbab596cb10368e6ad
Author: (...)
Date: Thu Jun 21 14:27:11 2012 +0900
test for Notes
Notes:
TEST NOTES
git log HEAD
commit 223073803bca6d54e2d4b6cbab596cb10368e6ad
Author: (...)
Date: Thu Jun 21 14:27:11 2012 +0900
test for Notes
Notes:
TEST NOTES
こんな感じで git log で表示される。
git push すると github 上でも commit ページで表示される。
これだけでも使えるが、問題は複数の人でnotesをいじる場合、 merge と同じように conflict の問題が発生する。こういう場合は namespace を分けてnotes をつけるとよい。
git notes --ref backport-1.0 add -m "TEST NOTES 2 in namespace" HEAD
git log -1 --show-notes=*
commit 223073803bca6d54e2d4b6cbab596cb10368e6ad
Author: (...)
Date: Thu Jun 21 14:27:11 2012 +0900
test for Notes
Notes:
TEST NOTES
Notes (backport-1.0):
TEST NOTES 2 in namespace
常に同じnamespaceを使う場合は GIT_NOTES_REF 環境変数を設定すればよい。namespaceを指定しない場合のデフォルトは commits という namespace である。
export GIT_NOTES_REF=refs/notes/backport-1.0
上記 git config の設定ではpush/pull時にすべての notes も一緒に同期する。不要であれば毎回手動で指定する方法でも可能。この辺は tag の指定と同じ。
参考リンク
http://git-scm.com/2010/08/25/notes.html