Git merge single file from another repository into my own

后端 未结 4 762
耶瑟儿~
耶瑟儿~ 2020-12-31 13:08

Say I have my own git repo with a bunch of text files in it. There is another different git repo that someone else owns with a bunch of text files that all differ from my ow

4条回答
  •  清酒与你
    2020-12-31 13:42

    Try to add the other-repo then bring its branches including your target-branch

    git remote add other git@github.com:username/other-repo.git
    git fetch other
    

    Switch to the branch you want to merge in the target-file.ext:

    git checkout your-branch
    

    Merge the target file into yours:

    git checkout -p other/target-branch target-file.ext
    

提交回复
热议问题