If you want to keep the file $ git checkout <filename> $ git add <filename> $ git commit If you want to discard the file $ git rm <filename> $ git commit