[英]git copy Files from [branch] and paste at under other [branch or master]
我创建存储库如下...,
TestRepo.git
|
|_[Branch.Master]
|____________Master.txt
|_[Branch.Develop]
|____________Develop.txt
我想复制Develop.txt
并粘贴在[Branch.Master]
。
/// So I checkout Develop first.
$ git checkout Develop
/// Then I push develop.txt to remote/master
$ git push origin develop:master
/// Then I pull remote/master to my local/master.
然后我得到了低于我想要的结果。
TestRepo.git
|
|_[Branch.Master]
|____________Develop.txt
|_[Branch.Develop]
|____________Develop.txt
我想要的是下面的样子。
TestRepo.git
|
|_[Branch.Master]
|____________Master.txt
|____________Develop.txt
|_[Branch.Develop]
|____________Develop.txt
我不想被替换,我想要的只是追加。
感谢您的建议。
如果您要做的只是添加一个新文件,只需将文件从源分支复制到目标分支即可。
git checkout master
git checkout Develop Develop.txt
然后添加文件,提交并推出分支。
git add Develop.txt
git commit -m 'Added Develop.txt to the master branch'
git push origin master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.