title: How does git track changes to files
body: <p>For the longest time I thought git commits keep diffs of changed files and not copies. Any information I could find states the contrary. I conducted a little experiment:</p>
  
  <pre><code>$ git init
  $ subl wtf
  </code></pre>
  
  <blockquote>
    <p>Here I create a file with 99 999 lines, each of which is <em>foo bar baz <strong>#line</em></strong></p>
  </blockquote>
  
  <pre><code>$ ls -la
  total 1760
  drwxrwxr-x 3 __user__ __user__    4096 Aug 13 21:02 .
  drwxr-xr-x 3 __user__ __user__    4096 Aug 13 19:57 ..
  drwxrwxr-x 7 __user__ __user__    4096 Aug 13 21:02 .git
  -rw-rw-rw- 1 __user__ __user__ 1788875 Aug 13 21:02 wtf
  $ git add --all
  $ git commit -m 'Initial commit'
  [master (root-commit) 6ef5084] Initial commit
   1 file changed, 99999 insertions(+)
   create mode 100644 wtf
  $ subl wtf
  $ git diff
  diff --git a/wtf b/wtf
  index 7ba3acb..bf7a9ed 100644
  --- a/wtf
  +++ b/wtf
  @@ -14156,7 +14156,7 @@ foo bar baz 14155
   foo bar baz 14156
   foo bar baz 14157
   foo bar baz 14158
  -foo bar baz 14159
  +foo qux baz 14159
   foo bar baz 14160
   foo bar baz 14161
   foo bar baz 14162
  $ git add --all
  $ git commit -m 'bar -&gt; qux on #14159'
  [master 1b5ab4b] bar -&gt; qux on #14159
   1 file changed, 1 insertion(+), 1 deletion(-)
  $ subl wtf
  $ git diff
  diff --git a/wtf b/wtf
  index bf7a9ed..1aeeaa3 100644
  --- a/wtf
  +++ b/wtf
  @@ -14156,7 +14156,7 @@ foo bar baz 14155
   foo bar baz 14156
   foo bar baz 14157
   foo bar baz 14158
  -foo qux baz 14159
  +xyz abc baz 14159
   foo bar baz 14160
   foo bar baz 14161
   foo bar baz 14162
  $ git add --all
  $ git commit -m 'foo qux -&gt; xyz abc on #14159'
  [master 85ccf97] foo qux -&gt; xyz abc on #14159
   1 file changed, 1 insertion(+), 1 deletion(-)
  $ ls -la
  total 1760
  drwxrwxr-x 3 __user__ __user__    4096 Aug 13 21:02 .
  drwxr-xr-x 3 __user__ __user__    4096 Aug 13 19:57 ..
  drwxrwxr-x 9 __user__ __user__    4096 Aug 13 21:05 .git
  -rw-rw-rw- 1 __user__ __user__ 1788875 Aug 13 21:04 wtf
  </code></pre>
  
  <p>Even commits on different branches with conflicts didn't change the situation.</p>
  
  <p>If git truly keeps copies of all changed files with every commit, how come there was no significant change in space used?</p>