git に入門する。
いい加減、太古のバージョン管理システムCVS から脱却したいので git への完全移行を目指す。Software Design の4月号に git の記事があったのでざっと読んでみた。git のフロントエンドは cogito を使うのが一般的かと思ってたんだけど、最近はそうでもないらしいので素の git の使い方を覚えることにした。
% apt-get install git-core
として git を実行すると、
[hamano@kujira]% git
git, the filemanager with GNU Interactive Tools, is now called gitfm.If you are looking for git, Linus Torvald’s content tracker, install
the cogito and git-core packages and see README.Debian and git(7).This transition script will be removed in the debian stable
release after etch.If you wish to complete the transition early, install git-core
and use (as root):
update-alternatives –config gitPress RETURN to run gitfm
こんな感じで怒られるけど、これは GNU Interactive Tools が同じ git コマンドだかららしい。
% update-alternatives –config git
There are 2 alternatives which provide `git’.
Selection Alternative
———————————————–
*+ 1 /usr/bin/git.transition
2 /usr/bin/git-scmPress enter to keep the default[*], or type selection number:
ここで2ばんを選ぶと本当に使いたい git が使えるようになった。
手始めに .zshrc や .emacs などのホームディレクトリ以下の設定ファイルを git で管理してみる。通常のソースコードの管理と違うのは
% git clone /git/dotfiles.git ~
destination directory ‘/home/hamano’ already exists.
というように設定ファイル群をホームディレクトリ以下にぶちまけようと思っても既にディレクトリが存在していると失敗してしまう。なので
% git clone –bare /git/dotfiles.git ~/.git
% git checkout
というように –bare オプションを付けて裸の .git レポジトリをホームディレクトリに置いて checkout するとよさそうだけど、残念なことに origin ブランチが無い事に気がついた。origin ブランチを手動で追加する方法が解らなかったので(.git/remotes/を直接触れば出来そう、1.5以降では git remote というサブコマンドが在るようだ)
% git clone /git/dotfiles.git tmp
% mv tmp/.git ~
% git checkout
というようにしてホームディレクトリ以下に設定ファイルを展開した。これで git pull で origin ブランチとの同期が取れるようになった。
これからじわじわと git に移行していく予定。
Permanent Link: http://www.cuspy.org/blog/archives/595
Trackback URL: http://www.cuspy.org/blog/archives/595/trackback
Robert wrote related post…
Silk posts and stories…
Trackback by Robert wrote related post — 2008/06/19 Thursday @ 22:06:54