Git reset single file in feature branch to be the same as in master

This question already has an answer here:

  • Reset or revert a specific file to a specific revision using Git?

    26 answers

  • How to properly clone a TFS Git repository from a command line?
  • Distributed Version Control Systems and the Enterprise - a Good mix?
  • How to use to make a file executable on Openshift server after pushing it via git
  • Find out which local branches are out of sync with remote
  • How to block push to master branch on remote
  • What user runs the git hook?
  • Bower Install error: Unable to connect & exit code of #128
  • Unable to auto-detect email address
  • How to start versioning a composer package?
  • Git Pre-Commit Using Sed To Dynamically Inject Branch Name
  • Using git in Windows, does the --shared option to git-init do anything useful?
  • EC2 can't SSH into github
  • 2 Solutions collect form web for “Git reset single file in feature branch to be the same as in master”

    If you want to revert the file to its state in master:

    git checkout origin/master [filename]

    you are almost there; you just need to give the reference to master; since you want to get the file from the master branch:

    git checkout master -- filename

    Note that the differences will be cached; so if you want to see the differences you obtained; use

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