Let's say I have a myfile.txt file. It has a paragraph of text in it, and I copy it to the new myfile2.txt file.
If I git diff, it will show myfile2.txt as a new file. Good. Now I replace each appearance of "the" with "hello" and commit.
The problem I ran into is that after committing the transaction, git diff will show all myfile2.txt as a new file, and it wonβt show me that βtheβ was replaced with βhiβ everywhere (because, as far as total, this is a new change).
Even if I first make and click on the myfile2.txt file before editing, so that the changes are obvious, this is not a good solution. This is a problem because if I squash, intercept a function and commit it, myfile2.txt appears as a completely new file, whereas I would like to see these replacements made.
Is there a git function that allows me to track changes in a file that was copied from another, so diff git will show me only those changes and not the added file as a whole?
source
share