title: git bug: `git add` added more files then I expected and `git diff` is missing them after the commit
body: <p>I just encountered a strange Git behavior and not sure it is a bug or not. I was using Git 2.24 but then I upgraded to 2.26 and the behavior didn't change.</p>
  
  <p>So I had the following setup (only affected files are shown):</p>
  
  <pre><code>.
  +-- addons
      +-- gut
          +-- file1
          +-- file2
  
  +-- scripts
      +-- level.gd
  </code></pre>
  
  <p>So I made my change to <code>level.gd</code> and when deciding to commit noticed that I don't need <code>addons</code> directory. So I decided to get rid of it and issued the following commands:</p>
  
  <pre><code>rm -Rf addons
  git add addons/
  git commit -m "removed addons/gut"
  </code></pre>
  
  <p>Everything seemed intact: <code>git log</code> shows:</p>
  
  <pre><code>&gt; git log
  commit 8be3472798df93d015ab3023f9e9d406a76dbed5 (HEAD -&gt; master)
  Author: hedin_hiervard &lt;flame.beholder@gmail.com&gt;
  Date:   Sun Apr 26 11:13:02 2020 +0200
  
      removed addons/gut
  </code></pre>
  
  <p>So I continue with my first idea and when running <code>git status</code> I see there is nothing left to commit! Are my changes gone?! No, a quick check shows they are there. Have they been commited? Seems not:</p>
  
  <pre><code>&gt; git diff --summary -r HEAD^1 -r HEAD
  
  delete mode 100644 addons/gut/GutScene.gd
   delete mode 100644 addons/gut/GutScene.tscn
   delete mode 100644 addons/gut/LICENSE.md
   delete mode 100644 addons/gut/doubler.gd
   delete mode 100644 addons/gut/gut.gd
   delete mode 100644 addons/gut/gut_cmdln.gd
   delete mode 100644 addons/gut/gut_plugin.gd
   delete mode 100644 addons/gut/hook_script.gd
   delete mode 100644 addons/gut/icon.png
   delete mode 100644 addons/gut/icon.png.import
   delete mode 100644 addons/gut/logger.gd
   delete mode 100644 addons/gut/method_maker.gd
   delete mode 100644 addons/gut/one_to_many.gd
   delete mode 100644 addons/gut/optparse.gd
   delete mode 100644 addons/gut/plugin.cfg
   delete mode 100644 addons/gut/signal_watcher.gd
   delete mode 100644 addons/gut/source_code_pro.fnt
   delete mode 100644 addons/gut/spy.gd
   delete mode 100644 addons/gut/stub_params.gd
   delete mode 100644 addons/gut/stubber.gd
   delete mode 100644 addons/gut/summary.gd
   delete mode 100644 addons/gut/test.gd
   delete mode 100644 addons/gut/test_collector.gd
   delete mode 100644 addons/gut/thing_counter.gd
   delete mode 100644 addons/gut/utils.gd
  </code></pre>
  
  <p>What the h?</p>
  
  <pre><code>&gt; git status
  On branch master
  Your branch is ahead of 'origin/master' by 3 commits.
    (use "git push" to publish your local commits)
  
  nothing to commit, working tree clean
  </code></pre>
  
  <p>Let's annotate the file:</p>
  
  <pre><code>&gt; git annotate scripts/level.gd
  
  ...
  8be347279   (hedin_hiervard 2020-04-26 11:13:02 +0200   2708)   var weather_probs_array = rules.all_rules_in_section("weather_prob")
  ...
  </code></pre>
  
  <p>Look, my changes are in commit <code>8be347279</code>! But I'm 100% sure I didn't stage them there. And diff shows no file changes on that file! But annotate does. </p>
  
  <p>And what's even more strange:</p>
  
  <pre><code>&gt; git log --name-status HEAD^..HEAD
  commit 8be3472798df93d015ab3023f9e9d406a76dbed5 (HEAD -&gt; master)
  Author: hedin_hiervard &lt;flame.beholder@gmail.com&gt;
  Date:   Sun Apr 26 11:13:02 2020 +0200
  
      removed addons/gut
  
  D       addons/gut/GutScene.gd
  D       addons/gut/GutScene.tscn
  D       addons/gut/LICENSE.md
  D       addons/gut/doubler.gd
  D       addons/gut/gut.gd
  D       addons/gut/gut_cmdln.gd
  D       addons/gut/gut_plugin.gd
  D       addons/gut/hook_script.gd
  D       addons/gut/icon.png
  D       addons/gut/icon.png.import
  D       addons/gut/logger.gd
  D       addons/gut/method_maker.gd
  D       addons/gut/one_to_many.gd
  D       addons/gut/optparse.gd
  D       addons/gut/plugin.cfg
  D       addons/gut/signal_watcher.gd
  D       addons/gut/source_code_pro.fnt
  D       addons/gut/spy.gd
  D       addons/gut/stub_params.gd
  D       addons/gut/stubber.gd
  D       addons/gut/summary.gd
  D       addons/gut/test.gd
  D       addons/gut/test_collector.gd
  D       addons/gut/thing_counter.gd
  D       addons/gut/utils.gd
  M       rules/level.cfg
  M       scripts/level.gd
  </code></pre>
  
  <p>Why on Earth there is a difference in <code>git log</code> and <code>git diff</code> output and how my changes made into the commit?? Is a Git bug or I have a misunderstanding how Git basically works?</p>
  
  <p>EDIT1: Can't reproduce it. After doing <code>git reset --soft HEAD~1</code> I got all the changes back and staged:</p>
  
  <pre><code>&gt; git status
  On branch master
  Your branch is ahead of 'origin/master' by 2 commits.
    (use "git push" to publish your local commits)
  
  Changes to be committed:
    (use "git restore --staged &lt;file&gt;..." to unstage)
      deleted:    addons/gut/GutScene.gd
      deleted:    addons/gut/GutScene.tscn
      deleted:    addons/gut/LICENSE.md
      deleted:    addons/gut/doubler.gd
      deleted:    addons/gut/gut.gd
      deleted:    addons/gut/gut_cmdln.gd
      deleted:    addons/gut/gut_plugin.gd
      deleted:    addons/gut/hook_script.gd
      deleted:    addons/gut/icon.png
      deleted:    addons/gut/icon.png.import
      deleted:    addons/gut/logger.gd
      deleted:    addons/gut/method_maker.gd
      deleted:    addons/gut/one_to_many.gd
      deleted:    addons/gut/optparse.gd
      deleted:    addons/gut/plugin.cfg
      deleted:    addons/gut/signal_watcher.gd
      deleted:    addons/gut/source_code_pro.fnt
      deleted:    addons/gut/spy.gd
      deleted:    addons/gut/stub_params.gd
      deleted:    addons/gut/stubber.gd
      deleted:    addons/gut/summary.gd
      deleted:    addons/gut/test.gd
      deleted:    addons/gut/test_collector.gd
      deleted:    addons/gut/thing_counter.gd
      deleted:    addons/gut/utils.gd
      modified:   rules/level.cfg
      modified:   scripts/level.gd
  </code></pre>
  
  <p>So I unstaged them with <code>git reset</code> and properly re-added into 2 commits and now everything worked smooth.</p>
  
  <p>EDIT2: Ok, at least part of the problem is solved: it is indeed a bug in <code>git diff --summary</code>: </p>
  
  <pre><code>hedin@MacBook-Pro ~/P/ds&gt; git diff -r HEAD^1 -r HEAD
  diff --git a/scripts/board.gd b/scripts/board.gd
  index a9f177a0..43eeae10 100644
  --- a/scripts/board.gd
  +++ b/scripts/board.gd
  @@ -2927,11 +2927,6 @@ func set_observatory_notices() -&gt; void:
                  if b.is_observatory():
                          b.observatory_set_new_cards(true)
  
  -func reset_all_workshops() -&gt; void:
  -       for b in _tower_blocks.values():
  -               if b.is_workshop():
  -                       b.reset_timer(Block.TimerType.WORKSHOP_PRODUCING)
  -
   func has_charged_dynamite() -&gt; bool:
          for b in _blocks.values():
                  if b.has_charged_dynamite():
  diff --git a/scripts/level.gd b/scripts/level.gd
  index cfa1f0df..d079cedb 100644
  --- a/scripts/level.gd
  +++ b/scripts/level.gd
  @@ -305,10 +305,7 @@ func _on_player_decks_can_draw_changed(type: int) -&gt; void:
          if player_decks.decks[type].can_draw():
                  return
          _update_ui_state()
  -       match type:
  -               CardDesc.Type.TOOL:
  -                       board.reset_all_workshops()
  -
  +       
   func _set_player_draws_left(val):
          player_draws_left = val
          emit_signal("player_draws_changed", val)
  hedin@MacBook-Pro ~/P/ds&gt; git diff --summary -r HEAD^1 -r HEAD
  hedin@MacBook-Pro ~/P/ds&gt; git diff --compact-summary -r HEAD^1 -r HEAD
   scripts/board.gd | 5 -----
   scripts/level.gd | 5 +----
   2 files changed, 1 insertion(+), 9 deletions(-)
  hedin@MacBook-Pro ~/P/ds&gt; 
  </code></pre>
  
  <p>But I still don't get how my changes ended up in the commit.</p>