I renamed a file in a git repository with:
git mv oldname.py newname.py
git add newname.py
Git doesn't move history of edits in a file when you move. It would create a huge set of problems when doing patching, reverting commits etc.
git mv is a shortcut for removing file and adding to list of tracked files.
GitHub doesn't show complete history of files but you can do it manually with
git log --follow newname.py, it should show changes before