Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
31
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

@misopeso

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

いつものように 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.

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
31
Help us understand the problem. What are the problem?