使用两个单独的存储库并同步它们之间的更改
Working with two separate repos and syncing changes between them
我是一个有点 new/basic git 的用户,我遇到了一个我似乎无法找到答案的问题。我正在尝试找出一种方法,可以在我的计算机上本地存储 github 存储库中的两个不同分支。我的理解是,当我从 Github 将 repo 克隆到我的笔记本电脑时,它还会下载我本地计算机的所有分支和提交历史记录。我想继续使用 github 作为我项目的 control/backup 版本。但是,我正在与理解 git 比我少的同事一起工作,因此我试图找到一种方法来帮助他们同时保持一切简单。
情况描述如下:
- 我们正在 RStudio 中开发一项分析,以检查有关大学生定量写作的信息。
- 我正在编写 R 分析脚本并希望使用 github
维护安全备份
- 我正在通过 Google 驱动器与我的同事共享项目文件,因为他们不知道如何使用 git/ github
- 我已经到了要更改项目的基本文件结构的地步。但是,我不想在进行这些更改时破坏他们执行分析的能力。
- 我的同事需要能够将分析输出保存到项目文件夹,在那里它们通过 Google Drive 同步回我,然后推送到 GitHub。
我能想到两种方法来处理这种情况,但似乎都存在我看不到的问题。
Create a branch in github, make changes to the branch and then merge the branch with the master
This won't work because I am sharing the files via Google Drive and you can only have one branch of a repo on your local machine at a time. Once clone the branch to my machine, that is what gets shared via Google Drive and any changes I make disrupts everyone else's workflow.
创建我的存储库的第二个副本,在那里进行更改,然后将这些更改推送到通过 Google Drive ##
共享给同事的原始存储库
I have no idea how to do this. Everything I have read discusses how to push/pull between different github users. How can I do this as a single user?
我是不是忘记了什么重要的事情?
任何 help/suggestions 非常感谢。
您可以通过添加第二个远程源在同一目录中完成所有操作,如果您已经将 GitHub 添加为 'origin',则 运行:
git remote add gdrive https://example.com/path/to/repo.git
然后你可以推送你对两个仓库所做的更改
推送到 GitHub:
git push origin
然后推送到GitHub
git push gdrive
看到这个github doc page
我是一个有点 new/basic git 的用户,我遇到了一个我似乎无法找到答案的问题。我正在尝试找出一种方法,可以在我的计算机上本地存储 github 存储库中的两个不同分支。我的理解是,当我从 Github 将 repo 克隆到我的笔记本电脑时,它还会下载我本地计算机的所有分支和提交历史记录。我想继续使用 github 作为我项目的 control/backup 版本。但是,我正在与理解 git 比我少的同事一起工作,因此我试图找到一种方法来帮助他们同时保持一切简单。
情况描述如下:
- 我们正在 RStudio 中开发一项分析,以检查有关大学生定量写作的信息。
- 我正在编写 R 分析脚本并希望使用 github 维护安全备份
- 我正在通过 Google 驱动器与我的同事共享项目文件,因为他们不知道如何使用 git/ github
- 我已经到了要更改项目的基本文件结构的地步。但是,我不想在进行这些更改时破坏他们执行分析的能力。
- 我的同事需要能够将分析输出保存到项目文件夹,在那里它们通过 Google Drive 同步回我,然后推送到 GitHub。
我能想到两种方法来处理这种情况,但似乎都存在我看不到的问题。
Create a branch in github, make changes to the branch and then merge the branch with the master
This won't work because I am sharing the files via Google Drive and you can only have one branch of a repo on your local machine at a time. Once clone the branch to my machine, that is what gets shared via Google Drive and any changes I make disrupts everyone else's workflow.
创建我的存储库的第二个副本,在那里进行更改,然后将这些更改推送到通过 Google Drive ##
共享给同事的原始存储库I have no idea how to do this. Everything I have read discusses how to push/pull between different github users. How can I do this as a single user?
我是不是忘记了什么重要的事情? 任何 help/suggestions 非常感谢。
您可以通过添加第二个远程源在同一目录中完成所有操作,如果您已经将 GitHub 添加为 'origin',则 运行:
git remote add gdrive https://example.com/path/to/repo.git
然后你可以推送你对两个仓库所做的更改
推送到 GitHub:
git push origin
然后推送到GitHub
git push gdrive
看到这个github doc page