2

My teammate removed a branch from remote repository. It was easy to fix by using 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.

ABCDEF
  • 21
  • 2

1 Answers1

1

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

Community
  • 1
  • 1
ponayz
  • 237
  • 4
  • 13
  • That explains a lot. But the next question is - shouldn't git prevent situations like this one? I mean - shouldn't it save all code history, no matter if it was on deleted branch or not? – ABCDEF Apr 20 '16 at 07:00
  • Well I guess it should in some way but I think their approach was more "you know what you do so i'll trust you and do what you say". also i think the fact that you keep a local track of everything you've fetched helps, even more with the reflog – ponayz Apr 20 '16 at 20:00