Git将功能分支中的单个文件重置为与master中的相同 [英] Git reset single file in feature branch to be the same as in master

查看:283
本文介绍了Git将功能分支中的单个文件重置为与master中的相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在功能分支的单个文件中还原所做的更改,并且希望此文件与master中的文件相同.

I'm trying to revert my changes in a single file in my feature branch and I want this file to be the same as in master.

我尝试过:

git checkout -- filename
git checkout filename 
git checkout HEAD -- filename

似乎这些都没有对我的功能分支进行任何更改.有什么建议?

It seems that none of these made any changes to my feature branch. Any suggestions?

推荐答案

如果要将文件恢复为master中的状态:

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

git checkout origin/master [filename]

这篇关于Git将功能分支中的单个文件重置为与master中的相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆