LoginSignup
32
31

More than 5 years have passed since last update.

Git 2.0 で git add の挙動が変わる?

Posted at

いつものように git add したら、以下のようなメッセージが。

$ git add .
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 'app/assets/images/button/do_register.png' 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 2.0 で git add の挙動が変わるらしい。man ページによると、

http://git-scm.com/docs/git-add/1.8.3

In future versions of Git, "git add ..." will be a synonym to "git add -A ..." and "git add --ignore-removal ..." will behave like today's "git add ...", ignoring removed files.

現在のデフォルトの挙動である git add --ignore-removal が git add -all に変わるらしい。

現在のバージョンでは、既に git の管理下にあるファイルが物理的に削除された場合に git add してもステージングされなかったが、今後はされてしまうということになる。

今の挙動でいい気がするんだけど、気にしておかないとはまりそう。

また、他にも変更が予定されていて、デフォルトの pathspec が適用されなくなるらしい。

If no is given, the current version of Git defaults to "."; in other words, update all tracked files in the current directory and its subdirectories. This default will change in a future version of Git, hence the form without should not be used.

ここは、指定した方がいいので、いまのうちから癖づけておいた方がよさそう。

32
31
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
32
31