git checkout/reset commit_hash with link

For example next path:

git clone

git reset –hard 7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1

fatal: Cannot do hard reset with paths.

Same problem for checkout

How can I do ‘git reset’ with commit_hash(7245bff300d3fa8bacbef7897ff080a6f1c23eba) with link=’?w=1′

>Solution :

You cannot do git reset --hard to a file, only to a commit:

git reset --hard 7245bff300d3fa8bacbef7897ff080a6f1c23eba

You can checkout a single file from a commit to the current worktree:

git checkout 7245bff300d3fa8bacbef7897ff080a6f1c23eba ext/spl/spl_directory.c

Leave a Reply