How can I create a copy of a file and make it so that git understands where it is coming from? If I just do a copy and add it to the branch, git is not able to figure it out:
$ git log --oneline --graph --name-status master
* 70f03aa (master) COpying file straight
| A new_file.txt
* efc04f3 (first) First commit for file
A hello_world.txt
$ git diff master:new_file.txt master:hello_world.txt
$ git blame -s master -- hello_world.txt
^efc04f3 1) I am here
^efc04f3 2)
^efc04f3 3) Yes I am
$ git blame -s master -- new_file.txt
70f03aab 1) I am here
70f03aab 2)
70f03aab 3) Yes I am
$ git blame -s --follow master -- new_file.txt
70f03aab 1) I am here
70f03aab 2)
70f03aab 3) Yes I am
This can be done with some additional work on a separate branch.
Using the rename on the side and getting the file back when merging on the original files that I used for the question, we get:
Rationale is that if you want to see history of the original file git will do it without issues.... if you want to do it on the copy, then git will have to follow the separate branch used for moving the file (as that is where the file is coming from) and then it will be able to jump to the original file when going back in time.