简体   繁体   English

用master分支中的相同文件覆盖当前分支中的单个文件?

[英]Overwrite single file in my current branch with the same file in the master branch?

Say I have two branches - master and redesign . 假设我有两个分支- master分支和redesign分支。 How would I go about overwriting the file default.aspx.cs in my redesign branch with the one from master? 我该如何用master的那一个覆盖我的redesign分支中的文件default.aspx.cs

I found this question but it seems to go over how to revert a file back to it's previous version in the same branch. 我发现了这个问题,但是似乎遍历了如何将文件还原到同一分支中的先前版本。 I also considered using a merge , but I don't want to merge, I want to overwrite. 我也考虑过使用merge ,但是我不想合并,我想覆盖。 Suggestions? 有什么建议吗?

git checkout master path/to/default.aspx.cs

Before doing this, you probably have to : git checkout redesign 在此之前,您可能必须: git checkout redesign

So, just git checkout FROM_BRANCH_NAME path/to/file 因此,只需git checkout FROM_BRANCH_NAME path/to/file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM