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

  • Which version control allows access permission on file level?
  • Can Git Remotes be Cascaded?
  • Git remove file without other on the team having it deleted
  • TortoiseGit Git Commit message from script
  • Msysgit git svn character encoding
  • TeamCity repeatedly downloading and updating jetbrains.git plugin
  • How should I organize source control for Android projects including libraries?
  • More compact relative dates in log?
  • Scala IDE and classpath
  • Git tag release version?
  • Using maven-release-plugin to tag and commit to non-origin
  • Delete all git branches which don't add diff over master
  • 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.