如何将 "shadow" git 存储库与主存储库同步 "secretly"
how to sync a "shadow" git repository with a main repository "secretly"
我有一个客户,我通过 git 存储库为其工作。我不想让他知道我正在部分使用另一个开发人员。因此,我创建了一个 "shadow" 存储库,我的开发人员正在使用它。
如何将"shadow"仓库与主仓库同步,让主仓库不知道发生了什么?
- 我不能与 git 命令合并,因为这会暴露我真正做了什么。
- 我可以复制和粘贴所有文件,但在 git 中可以看到我已删除所有文件并替换为同名的新文件。这看起来不太好。
- 我的客户正在使用 bitbucket。我可以向其他开发人员提供我的 bitbucket 登录信息,但我想避免这样做。
- 真正有效的是,我可以在主存储库中打开一个文件,删除内容,然后粘贴更新的代码。然后我可以提交,看起来我是否直接在主存储库中完成了工作。但这很耗时(我没有太多时间)。
有没有其他方法可以"secretly" 将文件内容从影子存储库复制到主存储库?是否有 linux/osx-command 我可以使用它来替换文件的内容而不删除和重新创建文件(然后我可以递归地使用它)?是否有一个 git-command 可以在不留下我实际所做的证据的情况下实现这一点?
您可以使用命令行让不同的 git 存储库修改同一组 local 文件。只需使用 GIT_DIR 环境变量。 Git 个存储库是完全独立的,可以跟踪同一目录中的文件。
rem set Git to use the sub-developer's git repository
set GIT_DIR=/path/to/sub/repository.com
rem verify which repository that you are on
git rev-parse --git-dir
rem pull the sub-developer's latest
git pull
rem merge, commit, change, push, change branches, whatever
rem ... when the code is the way you want it
rem switch to client repository
set GIT_DIR=/path/to/client/repository.com
rem bring main repository up to date
git commit -m"changes brought over from sub-developer"
rem push the updated code to the client repository
git push
这对其他开发实践很有用,例如版本控制实验室数据、本地开发实用程序、工作日志和其他 'misc' 似乎与源代码一起累积但不应与源代码一起存档的文件.
在第一次回答错误后,我觉得有必要再试一次。
尝试阅读子开发人员分支并 comparing/merging 到主分支 git 差异。 'diff.external' 参见 'git help config'。我使用 diffuse.exe 和一个批处理文件来映射参数。
工作流程看起来像这样。
rem make a remote to the sub
git remote add MYSUB https://path/to/sub/repository.com
rem see what branches are there
git remote show MYSUB
rem get the branch from the subdeveloper
git fetch MYSUB CurBranch:CurBranch
rem view/manually merge just the modified files
git diff --diff-filter=M MYSUB/CurBranch
rem cleanup
git branch -D MYSUB/CurBranch
git rm MYSUB
rem push to main site
git push
这是我通过 USB 记忆棒将分支传输到我的实验室机器的方法。我没有尝试过远程连接。
我有一个客户,我通过 git 存储库为其工作。我不想让他知道我正在部分使用另一个开发人员。因此,我创建了一个 "shadow" 存储库,我的开发人员正在使用它。
如何将"shadow"仓库与主仓库同步,让主仓库不知道发生了什么?
- 我不能与 git 命令合并,因为这会暴露我真正做了什么。
- 我可以复制和粘贴所有文件,但在 git 中可以看到我已删除所有文件并替换为同名的新文件。这看起来不太好。
- 我的客户正在使用 bitbucket。我可以向其他开发人员提供我的 bitbucket 登录信息,但我想避免这样做。
- 真正有效的是,我可以在主存储库中打开一个文件,删除内容,然后粘贴更新的代码。然后我可以提交,看起来我是否直接在主存储库中完成了工作。但这很耗时(我没有太多时间)。
有没有其他方法可以"secretly" 将文件内容从影子存储库复制到主存储库?是否有 linux/osx-command 我可以使用它来替换文件的内容而不删除和重新创建文件(然后我可以递归地使用它)?是否有一个 git-command 可以在不留下我实际所做的证据的情况下实现这一点?
您可以使用命令行让不同的 git 存储库修改同一组 local 文件。只需使用 GIT_DIR 环境变量。 Git 个存储库是完全独立的,可以跟踪同一目录中的文件。
rem set Git to use the sub-developer's git repository
set GIT_DIR=/path/to/sub/repository.com
rem verify which repository that you are on
git rev-parse --git-dir
rem pull the sub-developer's latest
git pull
rem merge, commit, change, push, change branches, whatever
rem ... when the code is the way you want it
rem switch to client repository
set GIT_DIR=/path/to/client/repository.com
rem bring main repository up to date
git commit -m"changes brought over from sub-developer"
rem push the updated code to the client repository
git push
这对其他开发实践很有用,例如版本控制实验室数据、本地开发实用程序、工作日志和其他 'misc' 似乎与源代码一起累积但不应与源代码一起存档的文件.
在第一次回答错误后,我觉得有必要再试一次。
尝试阅读子开发人员分支并 comparing/merging 到主分支 git 差异。 'diff.external' 参见 'git help config'。我使用 diffuse.exe 和一个批处理文件来映射参数。
工作流程看起来像这样。
rem make a remote to the sub
git remote add MYSUB https://path/to/sub/repository.com
rem see what branches are there
git remote show MYSUB
rem get the branch from the subdeveloper
git fetch MYSUB CurBranch:CurBranch
rem view/manually merge just the modified files
git diff --diff-filter=M MYSUB/CurBranch
rem cleanup
git branch -D MYSUB/CurBranch
git rm MYSUB
rem push to main site
git push
这是我通过 USB 记忆棒将分支传输到我的实验室机器的方法。我没有尝试过远程连接。