Git reset and checkout by single command

Consider I’ve staged for committing a file (e.g. db/schema.rb) that I didn’t intended to change. I need to do:

git reset db/schema.rb
git checkout db/schema.rb

Can I do it by single command?

  • git pull error for git update-index --assume-unchanged files
  • Git clone return result=18 code=200 on a specific repository
  • What do the terms fork, master, origin, push, pull mean for Git and Github?
  • Having trouble working with a Git repository
  • Check status of local Python relative to remote with GitPython
  • Git Remove unwanted commits from a Pull Request
  • View changes from “git log -p” in “difftool”
  • Git: History of commits I have *checked out* since init/cloning
  • Fix git branch after another developer did a reset
  • Redo merge of just a single file
  • Git push stuck at 99%
  • How to backup git stash content?
  • 2 Solutions collect form web for “Git reset and checkout by single command”

    I tried this one and works well for me:

    git checkout HEAD -- path
    

    Simply reset with option --HARD

    git reset --HARD
    
    Git Baby is a git and github fan, let's start git clone.