git チュートリアル

http://www.kernel.org/pub/software/scm/git/docs/tutorial.html

"git diff" など git コマンドのマニュアルを参照するには、

 man git-diff

git を使う前に .gitconfig を作っておく。

$ cat >~/.gitconfig <<\EOF
[user]
        name = Your Name Comes Here
        email = you@yourdomain.example.com
EOF

新しいプロジェクトをインポートする

project.tar.gz という tar で固めたプロジェクトがあった場合、
以下のようにすると、git でリビジョン管理が出来る。

$ tar xzf project.tar.gz
$ cd project
$ git init-db
defaulting to local storage area

これで、ワーキングディレクトリ ".git" が作成された。

カレントディレクトリ以下の全てのファイルを指定する。

$ git add .

最後は、

$ git commit

コメントメッセージを書くためのプロンプトが表示される。
これで現在の状態をリポジトリに登録したことになる。

変更を加える

ファイルを更新して、以下のコマンドを実行する。

$ git diff

変更した箇所が確認出来る。

変更した内容をコミットする場合は、

$ git add file1 file2 file3
$ git commit file1 file2 file3

git add 済みのファイルを一括でコミットする場合は、

$ git commit -a