[英]replacing a file in a git branch with the same file from another branch?
Every time I update one of my git repo and fetch a new branch or commits I want to replace two of the new files with the ones in a specific branch. 每当我更新我的一个git repo并获取一个新的分支或提交时,我想用特定分支中的那些替换两个新文件。
I know that I can do that with checkout but... 我知道我可以通过结账来做到这一点,但......
What is the difference between 有什么区别
git checkout wanted_branch file_wanted
and 和
git checkout --merge wanted_branch file_wanted
? ?
In the form that you are mentioning, there is really no difference between the two and the --merge
is superfluous. 在你提到的形式中,两者之间确实没有区别,而且
--merge
是多余的。
--merge
option is mainly used when you are switching branches and you have local modifications in your working directory, so that rather than just saying you cannot switch branches, you can make git to attempt to do a three-way merge on the modifications and present you with checked out branch with or without the conflicts. --merge
选项主要用于切换分支并且在工作目录中进行本地修改时,不要只是说你不能切换分支,你可以让git尝试对修改进行三向合并。向您展示有或没有冲突的签出分支。
Also, when you do git checkout --merge -- file
during conflict, you get back the conflicted merge in file
( from the index) 此外,当你这样做
git checkout --merge -- file
冲突期间,你回来的冲突合并file
(从索引)
The above two are the uses for --merge
and in the form you mentioned, it is not different from git checkout some_branch -- file
以上两个是
--merge
,在你提到的形式中,它与git checkout some_branch -- file
没有区别git checkout some_branch -- file
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.