how to get back to previous commit on local file in git code example Example: how to commit file to previous commit in git $ git add new-file $ git commit --amend