我如何在不是工作室而是从同一遥控器克隆的本地存储库之间的提交?
我厌倦了在分支之间切换。因此,我在PC上将存储库克隆了两次。
现在,我有两个不同的回购文件夹。
我想将我对较旧克隆的特定本地提交复制到较新的克隆。哪一套git命令可以帮助我做到这一点? (也许是樱桃挑吗?)
I'm tired of switching between branches. So, I cloned the repo twice on my PC.
Now, I have two different folders of the same repo.
I want to copy a specific local commit that I have on the older clone to the newer clone. Which set of git commands can help me to do it? (cherry-pick maybe?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
长期,您想要的是使用GIT工作室。
为了修复您当前的情况,您可以通过从本地目录创建遥控器来挑选回购之间的挑选。
通过将另一个本地存储库作为遥控器添加并进行
git提取
,您可以将您想要的任何提交挑选出您想要的任何提交。例如,如果您想从
old_clone
中挑选以e9bee1bc
开始的sha consit:您也可以使用类似的策略将多个克隆的远程转换为工作者。例如,如果您想从原始项目创建一个工作室,并从
branch1
new_clone
添加本地副本到新的Worktree:Long term, what you want is to use git worktrees.
In order to repair your current situation, you can cherry-pick between repos by creating remotes from your local directories.
By adding another local repo as a remote and doing a
git fetch
, you can cherry-pick any commit you want from that repo with just the SHA.For example, if you want to cherry-pick the commit from
old_clone
with a SHA starting withe9bee1bc
:You could also use a similar strategy to convert your multiple cloned remotes into worktrees. For example, if you want to create a worktree from your original project and add a local copy of
branch1
fromnew_clone
to your new worktree: