I have already read other questions (1, 2, 3) about how to make git realize about a concrete move, but they don't answer my real doubt: is it possible to manually handle git move understandings while commiting, before the commit, or afterwards (altering the commit internal data). I am open to standard answers, and even to hacking the git repository files.
I am taking this seriously because letting git know a file has been moved, edited, replaced, etc, is very important when lately reviewing the file editions with any software, since the software will be able to accordingly show the file editions no matter which file moves or renames the developer did. I think it's a valuable info the commiter should take care of properly setting, since this way the commit saves more that a FS operation, but also the logical intentions of the developer, the true meaning of the project edits.
Usage cases:
Case 1:
- move file
main_configuration.txt
toconfigurations/production/configuration.txt
- create
main_configuration.txt
, add similar content to the previous but change a few lines
git understands that you edited a few lines on configuration.txt and you added a new file configurations/production/configuration.txt
. but I don't want to loose track of the production configuration file edits. it isn't a new file created on this commit :(
Case 2:
- delete file
a/a.txt
- create file
b/a.txt
with simmilar content
git understands a file move, but I do need the git history to properly explain that a/a.txt
has been deleted in this commit, and I need to keep the data that b/a.txt
has been created on this commit. It's a very important info and the final info that git tells is a severe mistake which can have analysis consequences.
There are lots of examples and others even more contextualized but I tried to make them as simple as they could be.