タグ / cvs

記事
gitを使って見た [2006/08/05 05:37]
バージョン管理にgitを使うことを考えて、少しcvsとの連携について調べて見た。cvsexportcommitまでは試したが、cvsとの連携についてのワークフローは、少々厄介だと思った。今回は、一応、基本的なことだけを書き残して、cvsとの連携は後日書く。まず、テスト用のファイルを用意する。$ mkdir testdir$ cd testdir$ echo "hello" > hello.txt$ ls -a. .. hello.txt$ cat hello.txthello次に、このディレクトリをgitで管理するためにリポジトリを作成し、そこにカレントディレクトリの内容をすべて追加する。$ git-init-db$ git-add .$ ls -a. .. .git hello.txt.gitというファイルが作成されていることがわかる。これがgitのリポジトリになる。ここで、直接hello.txtを編集して、commitする。$ echo "bye" >> hello.txt$ cat hello.txthellobye$ git-commit -aCommitting initial tree 42e387d3ccd3afe14d91453acca58e31be679a6c次に、CVSのように使うことを考える。testdirのクローンtestdir1を作成し、そのtestdir1/hello.txtを編集して、その変更をtestdirへ反映させる。まずは、クローンを作成する。$ cd ..$ ls -a. .. testdir$ git-clone testdir testdir1Generating pack...Done counting 3 objects.Deltifying 3 objects. 100% (3/3) doneTotal 3, written 3 (delta 0), reused 0 (delta 0)$ ls -a. .. testdir testdir1次に、testdir1/hello.txtを編集して差分を見る。$ cd testdir1$ echo "bye" > hello.txt$ cat hello.txtbye$ git-diffdiff --git a/hello.txt b/hello.txtindex 410ca14..b023018 100644--- a/hello.txt+++ b/hello.txt@@ -1,2 +1 @@-hello byeこの変更をcommitしてログを見る。$ git-commit -a$ git-log".git/COMMIT_EDITMSG" 10 lines, 210 characters writtencommit dd0ef1b14c2ff8743ff505c0fe677ff8d014a660Author: U-TATE-T43\ttate Date: Sat Aug 5 05:24:57 2006 +0900 removed the first line.commit a537a5d75869aedd237edae2fdf3556e1026d485Author: U-TATE-T43\ttate Date: Sat Aug 5 05:18:05 2006 +0900 initial commit. このままでは、testdir1での変更がcommitされただけで、この変更はtestdirにはまだ反映されていない。試しに、testdir2というクローンをtestdirから作って見る。$ cd ..$ git-clone testdir testdir2$ cat testdir2/hello.txthellobye反映させるためには、git-pushを使う。$ cd testdir1$ git-pushupdating 'refs/heads/master' from a537a5d75869aedd237edae2fdf3556e1026d485 to dd0ef1b14c2ff8743ff505c0fe677ff8d014a660Generating pack...Done counting 5 objects.Result has 3 objects.Deltifying 3 objects. 100% (3/3)...
CVSディレクトリのないディレクトリで "cvs update" [2006/07/24 23:40]
ふと、誤ってCVSディレクトリのないディレクトリで cvs update を行った。すると、そのサブディレクトリのうちでCVSディレクトリを含むディレクトリ内のファイルがupdateされた。cvs使って数年が経つけど、こんなふうに使えるとは知らなかった。