git:还原一个已删除的分支。 (我可以在该分支中找到一个``git log log -p sha`)的提交了)

发布于 2025-02-11 22:58:45 字数 242 浏览 1 评论 0原文

我删除了要还原的分支。 我试图恢复它,唯一能找到的是从git-log运行的提交: git log -p 4AFA3ABC4218B6251DEA24C910EACED6AF465D11。另外 - 看来此SHA仅出现在我的本地Mac上(当我的同事运行此git -log命令时,他会遇到错误),

我可以看到输出的变化,我想从此Git日志创建一个全新的分支输出。

我该如何轻松做到这一点?

I deleted a branch that i want to restore.
I tried to recover it and the only thing i could find is a commit from git-log running:
git log -p 4afa3abc4218b6251dea24c910eaced6af465d11. Also - it seems that this SHA appears only on my local mac (when my colleague run this git-log command he gets an error)

I can see the changes in the output and i would like to create a brand new branch from this git log output.

How can i easily do that?

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

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

发布评论

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

评论(1

遮云壑 2025-02-18 22:58:45

只需查看提交并创建分支即可。

git checkout 4afa3abc4218b6251dea24c910eaced6af465d11
git branch yourbranch

Just check out the commit and create the branch.

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