如何将远程Git仓库添加到本地非git仓库并保持更新(How to add remote Git repo to local non-git repo and keep it updated)
我正在处理一个项目,该项目已移至GitHub仓库,并在项目基础上进行了一些重大更新。 但是那些在同一项目基础上工作的人只有非更新版本。 那么如何将他们的本地非git repo转换为本地git repo并使用同一项目的新版本更新它们。
我已经浏览了git的所有文档但仍然不清楚
I am dealing with a project which was moved to GitHub repo with some major updates in the project base. But those who work on same project base has only the non updated version. So how to convert their local non-git repo to local git repo and update them with new version of the same project.
I have gone through all documentation of git and still I am not clear
最满意答案
一种方法是:
在本地代码库中使用git init ,添加所有内容并提交 添加GitHub仓库作为远程 ,名为“上游” 获取它,并加入两个代码库,遵循“ 如何在没有公共根目录的情况下加入两个git repos,其中所有修改过的文件都相同? ” 将你自己的分支推送到原始github仓库的一个分支,你添加为远程和名称origin :你有权推送到原点,而不是上游。 请参阅“ GitHub中原点和upstream之间有什么区别? ”。One way would be to:
git init in your local code base, add everything and commit add the GitHub repo as a remote, named "upstream" fetch it, and join the two codebase, following "How do I join two git repos without a common root, where all modified files are the same?" push your own branch to a fork of the original github repo, that you add as a remote, and name origin: you have the right to push to origin, not to upstream. See "What is the difference between origin and upstream in GitHub?".更多推荐
发布评论