git - Git - 一个代码用于 2 个 repos,一个用于推送,另一个用于拉取
问题描述
我找到了一些使用 git 提供代码的框架。因此,他们的任何更新都可以被提取并合并到我自己的代码中。
但与此同时,我的代码链接到了我自己的远程存储库。
所以,问题是——如何——以及是否有可能将相同的代码链接到一个远程存储库以提取他们的更新,并链接到另一个存储库以将所有更新推送到那里?所以工作流程可能是:
- 创建我自己的本地仓库并从远程仓库#1 中提取代码。
- 在我的本地仓库中进行开发并将代码推送到我的远程仓库#2。
- 从 repo #1 中提取更新(如果有)。
- 转到第 2 步。
如何?可能的?
解决方案
You can add an additional remote repo with git remote add <repo-name> <url>
-- just pick a unique name for the remote (not the same as the one you're pulling from!) and its URL.
Then, you can use git push <repo-name>
to push your current branch to the same named branch in that remote repo. You can use git branch -u <repo-name> <branch>
to set the default upstream of branch to be repo-name -- then you can use simply git push
to push to it (but you'll then need to use git pull <orig-repo>
to pull more changes from the original repo.)
推荐阅读
- tmux - tmux/tmuxinator 自定义面板布局
- javascript - 如何使用Javascript中的键数组过滤键值字典?
- erlang - 在 Elixir ExUnit 中,我如何保证 Supervisor 将创建一个新的 GeNserver?
- docker - 如何对在 Docker Desktop (Kubernetes) 中运行的 pod 进行 HTTP 调用
- python - 我将如何使用 BeautifulSoup 的索引来抓取多个表?
- typescript - Expected 0 type arguments, but got 1.ts(2558)
- r - 计算 R 中 2 个时间戳之间的秒数,不包括周末
- c# - 如何将 Unity 游戏中的表情符号存储到数据库中?
- speech-recognition - 如何使用 OneDrive 进行音频文件存储,而不是使用 Azure Blob 进行批量语音转录?
- c++ - 是否有任何可能的方法将事件(定制)附加到运行时创建的对象?[C++ Builder]