如何将远程Git仓库添加到本地非git仓库并保持更新(How to add remote Git repo to local non

编程入门 行业动态 更新时间:2024-10-27 02:19:25
如何将远程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?".

更多推荐

本文发布于:2023-08-01 01:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1351699.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:仓库   如何将   Git   git   local

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!