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

这个问题在这里已经有了答案:

  • 使用Git将特定文件重置或恢复到特定修订版本? 28个答案

  • 如果您想将文件恢复到master状态:

    git checkout origin/master [filename]


    你几乎在那里; 你只需要给大师提供参考; 因为你想从主分支获取文件:

    git checkout master -- filename
    

    请注意,这些差异将被缓存; 所以如果你想看到你获得的差异; 使用

    git diff --cached
    
    链接地址: http://www.djcxy.com/p/8971.html

    上一篇: Git reset single file in feature branch to be the same as in master

    下一篇: Reverting a single file to a previous version in git