R.A. Epigonos et al.

[Git] git commit --all と git add と git commit

git commit --all は HEAD の状態とワーキングツリーの状態を比較して、変更されたものと削除されたものの状態を index に登録して、index に登録された要素の状態をリポジトリに登録してその状態に commit を割り当てるコマンド。git add -- pathspec はワーキングツリー内の pathspec にマッチする要素の状態を index に登録するコマンド。git commit は index に登録された要素の状態をリポジトリに登録してその状態に commit を割り当てるコマンド。

git がやっていることの意味 (index の意味) を理解するには git add と git commit は別々にやったほうがいいかもしれない。

command HEAD index (stage) WORK_TREE
blob-hash file blob-hash file blob-hash file
$ git init;
$ echo foo.txt >> foo.txt; 7c6ded1 foo.txt
$ echo bar.txt >> bar.txt; 7c6ded1 foo.txt
e5dbdfd bar.txt
$ git add foo.txt bar.txt; 7c6ded1 foo.txt 7c6ded1 foo.txt
e5dbdfd bar.txt e5dbdfd bar.txt
$ git commit --message="update"; 7c6ded1 foo.txt 7c6ded1 foo.txt
e5dbdfd bar.txt e5dbdfd bar.txt
$ echo bar.txt >> bar.txt; 7c6ded1 foo.txt 7c6ded1 foo.txt
e5dbdfd bar.txt 9219c9a bar.txt
$ git add bar.txt; 7c6ded1 foo.txt 7c6ded1 foo.txt
e5dbdfd bar.txt 9219c9a bar.txt 9219c9a bar.txt
$ git commit --message="update"; 7c6ded1 foo.txt 7c6ded1 foo.txt
9219c9a bar.txt 9219c9a bar.txt

リファレンス

  1. Git - gitglossary Documentation
  2. Git - git-add Documentation
  3. Git - git-update-index Documentation

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2007-12-14T15:19:48+09:00
  2. Modified: 2007-12-14T15:19:48+09:00
  3. Generated: 2023-08-27T23:09:15+09:00