6. ファイルを追加し状態を 確認 git status : 変更されたファイルを表示する git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # lib/test.rb nothing added to commit but untracked files present (use "git add" to track) lib/test.rb ファイルを作成し、 git status コマンドを実行すると、追加・変更の あったファイルが一覧表示されます。
7. コミットファイルの指定 git add : コミットするファイルを指定する git add lib/test.rb git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: lib/test.rb lib/test.rb ファイルを git add コマンドでコミットファイルに指定し、 git status コマンドを実行。 Untracked files => Changes to be committed に変更され、次回コミットの 対象ファイルとして追加されたことが確認できます。 また、 git add . で、変更されたファイル全てをコミットの対象にできます。