简体   繁体   English

git push of subtree-remote推送了整个repo,如何撤消?

[英]git push of subtree-remote pushed the entire repo, how to undo?

I Git merged my repo feklee-node into my repo san . 的Git合并我的回购feklee节点到我的回购协议的SAN Commands 指令

$ git remote add -f node git@github.com:feklee/feklee-node.git
$ git merge -s ours --no-commit --allow-unrelated-histories feklee-node/master
$ git read-tree --prefix=node/ -u node/master
$ git commit # done from Emacs Magit IIRC
$ mv node/ nodes/pcb/

Then I did some changes in the repo san , and I wanted to get the changes in the subtree back into feklee-node . 然后我做的回购SAN一些变化,我希望自己能子树将更改回复到feklee节点 So I did (which obviously was a bad idea): 所以我做了(这显然是一个坏主意):

$ git push node master # node = git@github.com:feklee/feklee-node.git

This pushed the entire contents of san into feklee-node . 这将san的全部内容推到了feklee-node Oh no! 不好了!

How do I undo this massive git push? 我该如何撤消大规模的git push?

And also I wonder how to push only the subtree. 我也想知道如何仅推送子树。

Update 更新资料

I reverted back to an old commit, rewriting history: 我恢复到旧的提交,重写了历史记录:

$ git reset --hard 87b2d1aaea1c0a628c4725e2ea16682f344f102e
$ git push --force

Here I was lucky because I still had a browser tab open with the GitHub repo in the state before the massive push. 在这里,我很幸运,因为在大规模推送之前,我仍然打开了一个浏览器选项卡,其中GitHub存储库处于该状态。 It showed the above hash. 它显示了上面的哈希。

In order to undo a commit use 为了撤消提交使用

git revert

Pushing only to a subtree should look something like this: 仅推送到子树应如下所示:

git subtree push --prefix=my/folder subtree_origin master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM