$ git checkout 51c7d41b82b5b error: Your local changes to the following files would be overwritten by checkout: lib/Mojo/IOLoop/Stream.pm Please commit your changes or stash them before you switch branches. Aborting $ git checkout lib/Mojo/IOLoop/Stream.pm error: pathspec 'lib/Mojo/IOLoop/Stream.pm' did not match any file(s) known to git $ git add lib/Mojo/IOLoop/Stream.pm The following pathspecs didn't match any eligible path, but they do match index entries outside the current sparse checkout: lib/Mojo/IOLoop/Stream.pm hint: Disable or modify the sparsity rules if you intend to update such entries. hint: Disable this message with "git config advice.updateSparsePath false" $ git --version git version 2.32.0 Here I do not understand how to checkout to different commit or how to commit the subject file It would be nice to show hint about how to exlude this file from unindex -- Best regards, Eugen Konkov