There have been many excellent posts on how to preserve history when renaming files and folders in Git.
This works on the git command-line interface:
#if you don't modify oldname.cpp or newname.cpp, git will understand your rename
git mv old.cpp new.cpp
git commit -am "renamed old.cpp -> new.cpp"
git log new.cpp #only shows the new commit
git log --follow new.cpp #shows ALL the history of old.cpp and new.cpp
Great, so the --follow
command allows us to get all the history of new.cpp
after it's been renamed. This works great in the command-line interface to git.
But, in the github web interface, the history of old.cpp
doesn't show up for new.cpp
. This is a problem, because many of my team members see their github accounts as a part of their resumes. If their commits don't show up in github after renaming files, they're losing resume points. After a major filename/directory restructuring, a contributor can end up not having a single visible commit on a repo.
How do I get the full file history to show up in the github web interface (e.g. git log --follow
) after renaming files?
Or I am I stuck never renaming anything, unless I'm willing for casual github users to never see the old commits?