When I refactor the class in IntelliJ the git looses the track of old log of the file? Is there a way to refactor the file so that it keeps the log, or am I missing something?
I am checking the log of the file in the SourceTree, but I imagine it is the same for everything.
Move/Rename is handled automatically by Git and log should be kept if git detected that it was actually a move. It doesn't matter whether you rename from IDEA, terminal or file manager.
See also Why does git not "track" renames? and comments in the related bug report .
This approach, although probably not what you would like to hear, helped git detect renames (and ultimately understand the real file history) during a pretty big repackaging that I was doing (renaming package com.something
to com.somethingelse
with ~300 files inside it):
git mv MyProject\\src\\main\\java\\com\\something MyProject\\src\\main\\java\\com\\somethingelse
" Edit > Find > Replace in path
and replace all occurrences of com.something
with com.somethingelse
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.