使用git在Bitbucket中提交历史记录的问题

发布于 2025-02-03 17:52:30 字数 201 浏览 2 评论 0 原文

我面临问题,以恢复以前的提交,一旦我用来推动它,就表明了我使用的那个提交 - f并将其呼吸为以前的提交。有什么办法或有什么方法可以恢复我的历史?

当我回到上一个提交的链接时,它显示了此消息:

“此提交从此存储库中的任何分支或标签都无法实现。它可能来自此存储库以外的叉子。

我用来推动的代码: git push -f原始大师

I am facing issue to get back my previous commits, as soon as I used --f to push it shows just that commit where I used --f and earsed the previous ones. is there any way or any how to get back my commits history?

when I get back to link of the previous commit it shows this msg:

"This commit is unreachable from any branch or tag in this repository. It may be from a fork outside of this repository.

"

the code I used to push :
git push -f origin master

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神回复 2025-02-10 17:52:30

您可以用来

git reset --hard <commithash you need> 

恢复所需的提交(显然需要哈希)。

如果您丢失了所需的提交哈希,则可以使用

git reflog

确保在单独的分支上备份您当前的工作,以防您犯任何错误。

这可能会对您有所帮助:

You can use

git reset --hard <commithash you need> 

to restore your desired commit (you will need the hash obviously).

If you lost the desired commit hash you may be able to recover it using

git reflog

Make sure to backup your current work on a separate branch in case you make any mistake.

This might help you:
https://www.jvt.me/posts/2021/10/23/undo-force-push/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文