简体   繁体   English

为什么在 Git 中无法从远程恢复已删除的分支?

[英]Why it's not possible to restore a deleted branch from remote in Git?

My teammate removed a branch from remote repository.我的队友从远程存储库中删除了一个分支。 It was easy to fix by using git reflog .使用git reflog很容易修复。 But I noticed there's no way to do this without having a local copy of branch or reflog.但是我注意到没有分支或引用日志的本地副本就无法做到这一点。

My question is - what's the reason behind this?我的问题是 - 这背后的原因是什么? Since now all Git design decisions seemed to be reasonable, but I can't really understand this one.由于现在所有 Git 设计决策似乎都是合理的,但我无法真正理解这一点。

In my opinion it's because you don't just remove the tag of the branch it's because you push an empty branch above the existing one.在我看来,这是因为您不只是删除分支的标签,而是因为您将一个空分支推到现有分支之上。 Check this post : https://stackoverflow.com/a/23961231/2475001检查这篇文章: https : //stackoverflow.com/a/23961231/2475001

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

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