GIT how can I repair the history of a moved file (specifically for blame, etc)
Asked Answered
E

1

6

I moved a .js file from one folder to another manually. Now, although GIT seems to have the complete history log for the file, it still seems to treat the move as a delete/create event. Further, using git BLAME, I cannot go back to track changes beyond the point that I moved the file.

It's been a month or so and many commits since, but I would love to be able to "repair" that history so that GIT treats the entire commit history as the same file, without the cutoff point at the move.. and I would be able to step back using blame to track changes.

Can anyone help with this?

Elvaelvah answered 17/11, 2013 at 5:40 Comment(1)
Have you tried the -M and -C flags to git blame?Benzofuran
O
5

You should use the git-blame -C flag. This instructs Git to try to figure out where the individual lines actually came from, not just when they were committed. Although this sounds like the same thing, it's different in cases such as yours.

It seems like magic when you use it! Read the manual page for more info.

Overwhelming answered 17/11, 2013 at 8:22 Comment(1)
Note to self and others: This is a CAPITAL CArlenarlena

© 2022 - 2024 — McMap. All rights reserved.