I am a newbie in git and currently trying out various combinations to understand git.
I cloned my repository which had two files. Now i made changes to one file (let's say "first.txt") and committed it to staging.
After this step i wanted to reset the "first.txt" to its remote counterpart such that no git commit history related to "first.txt" was present for my branch. Now if I use -
git checkout origin/master first.txt
This will just replace my file with the remote file but git commit history for that file was not be replaced.
If i use -
git reset --hard <sha1 commit id>
then it restores the branch to that particular commit and all commits made there after are lost.
Now what i wanted to understand was if there is any method by which we can hard reset a file such that its entire content and commit history is restored to its remote's content and history.
Thanks for taking out time to read my question !
If downvoting then kindly let me know what else could have been improved in the question.
Thanks