I know there are "lots" of existing questions that looks similar, so let me summarize them before asking mine.
- The answer to Is it possible to move/rename files in git and maintain their history? is, "it is not possible".
- The conclusion for git moving file while keeping history is, Git may see it as a move, or it may still treat it as a delete + addition.
The answer to the first one, I don't agree, because I've done that before. The answer to the second one is the reason why I'm asking this question. I.e.,
I found I am doing git mv
all the times, but sometime it is treated as move/rename, and sometime it is treated as delete + addition. Thus, I want to know how I can make it always a move/rename?
Take this one as an example, at the bottom, we can see several move/rename cases, like easygenapi/tf-varcaser.go → tf-varcaser.go
. Note that such moves are across/between the folders! I.e., I did it!
But there are many other cases git mv
were treated as delete + addition, showing in the exactly same change log. Again, I am doing git mv
all the times. Why git
behave differently?
Is there any sure-fire way to move/rename git files while keeping the history?