Balu Nair
Balu Nair
Sep 7, 2018 · 1 min read

Shouldn't it be like this? Without --filename when its not for a specific file?

### Switch to the version of the code before the most recent commit
git reset HEAD^
git reset HEAD^ -- filename # for a specific file
### Switch back 3 or 5 commits
git reset HEAD~3
git reset HEAD~3 -- filename # for a specific file
git reset HEAD~5
git reset HEAD~5 -- filename # for a specific file
### Switch back to a specific commit
### Where the '0766c053' is the commit ID
git reset 0766c053
git reset 0766c053 -- filename # for a specific file
    Balu Nair

    Written by

    Balu Nair

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade