Beware of Git's Content Tracking
A while ago, I was wondering how rename tracking in Git worked. I was told that renames didn’t really exist in Git, as Git tracked content, not files themselves. Fair enough.
But, I just stumbled upon something:
1 $ gdc vendor/plugins/acts_as_money/LICENSE 2 diff --git a/vendor/plugins/acts_as_money/LICENSE b/vendor/plugins/acts_as_money/LICENSE 3 index e69de29..a273c73 100644 4 --- a/vendor/plugins/acts_as_money/LICENSE 5 +++ b/vendor/plugins/acts_as_money/LICENSE 6 @@ -0,0 +1,4 @@ 7 +one: 8 + user: active 9 + name: name 10 + description: description
Tell me, does that look right? I’ll manually fix that file, but that just decreased my confidence level in Git.
The original LICENSE file was empty, and there apparently was another file (a fixture file) that was empty too, and the latter saw some content added.
Why did this happen? LICENSE was updated as part of a merge—from a branch in which the LICENSE file doesn’t exist.