かべぎわブログ

ブログです

いらないものを削除したあとは git add -Aを利用する

概要

gitのローカルリポジトリでいらないファイル類を削除したあとにgit add *してcommitしてpushしようとしたら以下のようなエラーがでました。

warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal',
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like 'hosts/wrap-ansible-playbook' that are
removed from your working tree are ignored with this version of Git.

* 'git add --ignore-removal <pathspec>', which is the current default,
 ignores paths you removed from your working tree.

* 'git add --all <pathspec>' will let you also record the removals.

Run 'git status' to check the paths you removed from your working tree.

解決方法

git add -Aを実行するとよい。

git add -Aでは新規/編集/削除したファイルすべての情報をリポジトリに反映してくれます。

おわりに

エラーメッセージを和訳するとこのブログよりくわしい情報が手に入るよ。

わかばちゃんと学ぶ Git使い方入門〈GitHub、Bitbucket、SourceTree〉

わかばちゃんと学ぶ Git使い方入門〈GitHub、Bitbucket、SourceTree〉