Reputation: 522
First the question:
Is there any tool or patch to git that makes it specifically store metadata about file renames (much like git-svn does with "git-svn-id")? Failing this, is there another DVCS that gives me fast local branches (like git) and proper file rename tracking (like bazaar)?
Now some background as to why I need this:
I started using git for a few months and I really like it. Except for the fact that it doesn't track renames.
In my opinion, the decision not to track renames is based on the faulty assumption that it's the content that matters, not the name. I disagree. Let me give you a real-world example.
I had a class RefinementPresentation
which was used as a model in the view template of a web page. I move the class to a separate package (model) and then, because the class was more than simply a model and contained heavy logic, I refactored it by moving the logic to another class. As you can imagine, now the class bears little resemblance to the original class. But conceptually, it's the same thing - it's still the model for the view. And that is my point. Whether the file is the same file (renamed/moved) or a different file is a concept in my head, and no tool can or should attempt to do it for me. Being so different, no amount of heuristics or guessing will make git recognize that this is actually a moved file. Which means git log will never show me the history past move. Of course, the history is still there - it's not lost - it's simply harder to get to. Thus my question: is there a way to not have this inconvenience?
EDIT: move and refactor in separate commits is a good workaround, see comments below (thanks Eevee!).
Upvotes: 2
Views: 2643
Reputation: 48604
Least effort, greatest reward: move and refactor the file in separate commits.
For what it's worth, git isn't totally crazy here and has various sensible reasons for what it does—not that it's much consolation. :)
Upvotes: 3