git checkout -b branchname <sha1-of-commit or HEAD~3>
Mainly used if a remote repository name has changed.
git remote set-url origin {new-url}
If you are on the branch you want to rename:
git branch -m new-name
If you are on a different branch:
git branch -m old-name new-name
Add the file path to .gitignore.
If the file was already being tracked then:
git rm --cached <file>