LoginSignup
0
2

More than 3 years have passed since last update.

git add .した後にgit statusするとChanges not staged for commit:と出る時の対処法

Posted at

内容

GitHubにcommitしようと思いgit add . をしてgit status で確認したところ、"Changes not staged for commit:"と出てうまく反映されてなかった

実際出たエラー内容

$ git add .
$ git status
On branch login
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   app/controllers/users_controller.rb
    modified:   db/mysql/volumes/ib_logfile0
    modified:   db/mysql/volumes/ibdata1
    modified:   db/mysql/volumes/ibtmp1
    modified:   db/mysql/volumes/myapp_test/users.ibd
    modified:   db/mysql/volumes/mysql/innodb_index_stats.ibd
    modified:   db/mysql/volumes/mysql/innodb_table_stats.ibd
    modified:   spec/requests/users_signup_spec.rb

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   db/mysql/volumes/ibdata1

解決方法

このエラーの場合"db/mysql/volumes/ibdata1"がうまくステージされてないよと言われているので,ファイル名を指定してgit addコマンドを実行する

$ git add db/mysql/volumes/ibdata1
$ git status
On branch login
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   app/controllers/users_controller.rb
    modified:   db/mysql/volumes/ib_logfile0
    modified:   db/mysql/volumes/ibdata1
    modified:   db/mysql/volumes/ibtmp1
    modified:   db/mysql/volumes/myapp_test/users.ibd
    modified:   db/mysql/volumes/mysql/innodb_index_stats.ibd
    modified:   db/mysql/volumes/mysql/innodb_table_stats.ibd
    modified:   spec/requests/users_signup_spec.rb

ちゃんと反映されました!

最後に

コミットはこまめに行うので、エラーが出たら焦らず対処していきたいです。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2