直下のディレクトリ、ファイルをインデックスに追加

概要

指定したディレクトリに複数のディレクトリやファイルがある場合にそれらを全てコミット対象とする場合は

「git add .」とすることで全てを対象とすることが出来る


手順

ファイルを作成する

matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ echo "aaa" > test_data1.txt
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ echo "bbb" > test_data2.txt
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ mkdir test1
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ echo "ccc" > test1/test_data3.txt
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$
 

「git add .」で登録

matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ git add .
warning: LF will be replaced by CRLF in test1/test_data3.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test_data1.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test_data2.txt.
The file will have its original line endings in your working directory.
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$
 
※ワーニングはシステムの改行コードとファイル内の改行コードが異なるため

「git commit -m "コメント"」でコミット

matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$ git commit -m "git add . - test"
[master c772796] git add . - test
warning: LF will be replaced by CRLF in test1/test_data3.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test_data1.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test_data2.txt.
The file will have its original line endings in your working directory.
 3 files changed, 3 insertions(+)
 create mode 100644 test1/test_data3.txt
 create mode 100644 test_data1.txt
 create mode 100644 test_data2.txt
 
matsumoto@WKPC-MSHIGE1979 /d/demos/git_repo (master)
$
 


最終更新:2012年10月27日 07:52