gpt4 book ai didi

在 git 子目录中执行 git init

转载 作者:太空狗 更新时间:2023-10-29 13:36:20 24 4
gpt4 key购买 nike

我有一个 git 仓库,里面有一些子目录:

  ~/src
~/src/.git
~/src/mystuff
~/src/otherstuff

现在我想与 friend 分享otherstuff,我打算用 bitbucket 来做这件事。他们应该能够克隆它并在 otherstuff 中推送更改,但我不希望他们能够访问 srcmystuff(也不甚至看到它们存在)。

我该怎么做?我几乎进入了 cd ~/src/otherstuff 并执行了 git init, git remote add origin ssh://git@bitbucket.org/wim_glenn/.. . 但是当 git init 已经处于版本控制之下时,再次执行 git init 时有些不对劲。

最佳答案

在 git 存储库中创建一个 git init 是可行的:您在其中初始化嵌套 存储库的目录会被父存储库忽略。

但是,如果该子目录的历史很重要,最好是 export it as a separate repo (如 Nick suggested )。
从那里,您可以通过将新 repo 声明为 a submodule of the parent repo 来保持两个 repo 的锁定步骤。 .

关于在 git 子目录中执行 git init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15353858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com