gpt4 book ai didi

git - 如何在 git 上恢复远程裸仓库

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

我已经完成了此链接中描述的过程 http://toroid.org/ams/git-website-howto
它就像一个魅力,但现在我必须暂时将远程存储库(和 checkout )恢复到以前的状态。
我认为我可能只需要在本地恢复并推送(并且 checkout 将正常工作)但我不确定。
请注意,这不是最终的恢复,只是暂时的(把它想象成我在我应该之前将最新的更改推送到生产中)

最佳答案

在您的本地存储库中使用 git reset --mixed <commit>然后git push --force到 Remote 。您可能需要先存储未提交的更改。

来自git-reset manpage :

--mixed

Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.

关于git - 如何在 git 上恢复远程裸仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10521151/

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