Don Rhummy Don Rhummy - 1 month ago 6
Git Question

After moving files/directories, GitHub shows no history for the files but Git does - is this due to how I moved them?

We have a repo where we had a directory structure like:

/database-stuff
/main-project
/main-project/src/somefile.java
...elided...


We then moved the files to be like:

/database-stuff
/src/somefile.java
...elided...


After doing this and pushing the changes, on GitHub, when i view "history" for any of the files, it shows only today.

However, when I'm in IntelliJ and choose
git->Show History
on any file, it shows all their history (back to last year).

Is there a way to fix this? Do i need to move/commit file moves in a special way for git/GitHub to see them with full history?

Answer

By default, IntelliJ will show the full history (git log --follow) which follows file moves (even though the graphic version of that log is still buggy)

However, GitHub cannot do the same (for performance reason), and only shows the history for file without their prior location history.