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? 28 answers

  • 如果您想将文件恢复到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
    
    链接地址: http://www.djcxy.com/p/8972.html

    上一篇: Git只提交一些文件

    下一篇: Git重置功能分支中的单个文件与主文件中的相同