Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

See history in GitHub after folder rename

After renaming a folder (git mv foldername newfoldername) the history of this folder in Github has gone. I can still view the full history of any file in the folder if I clone the repro and run...

git log --follow ./newfoldername/file 

But is it possible to get history for renamed folders visible in Github? This is a Github question, the git revision history is working as expected. Thanks

like image 257
Patrick Clancey Avatar asked Jun 20 '13 11:06

Patrick Clancey


People also ask

How do I rename a directory in git without losing history?

emiller/git-mv-with-history. git utility to move/rename file or folder and retain history with it. # git-mv-with-history -- move/rename file or folder, with history. # Git has a rename command git mv, but that is just for convenience.

Does git keep track of moved files?

Git keeps track of changes to files in the working directory of a repository by their name. When you move or rename a file, Git doesn't see that a file was moved; it sees that there's a file with a new filename, and the file with the old filename was deleted (even if the contents remain the same).

How does git know a file has been renamed?

So to detect renames is a matter of comparing hashes. To detect small changes to a renamed file, Git uses certain algorithms and a threshold limit to see if this is a rename. For example, have a look at the -M flag for git diff . There are also configuration values such as merge.


2 Answers

I wrote a chrome extension to enable this. Source on github.

Github Follow Extension

like image 97
Stafford Williams Avatar answered Oct 02 '22 16:10

Stafford Williams


You just need a commit before the rename happened. You could retrieve it locally or via the Blame feature.

After you have retrieved the URL of such commit you just need to click History. You will then see all of the commit history of the file before the rename.

like image 29
Haralan Dobrev Avatar answered Oct 02 '22 14:10

Haralan Dobrev