I have been playing with Git for a while but I haven't found a good explanation of the technical details of renames.
I have always thought renames are somehow marked in the commit, so that space is saved and you can keep track of the history of the file before that rename. I was surprised to find out that the option --find-renames
is included in git log
and git show
, but not in git add
or similar, so I wonder, whether it is really only a way of presenting changes from commits or whether there is something special about renaming a file in Git.
I was facing a related problem. I wanted to convert a YAML file to a JSON one, which includes changing the content (more specifically changing every line of the original file) as well as renaming it (changing the extension). On the other hand, I think it really is a rename; when searching for the history of the JSON, you should also find the YAML one.
Depending on the answer to the first question: Is it possible to to find the YAML when searching for history of the JSON either by forcibly marking the conversion as a rename or by somehow instructing git log
to display it (I was not successful with git log --follow -M0
)?