4 ms·
I'd just like to respond to all the people who are saying "Use the reflog" here. Yes, you can recover lost commits using the reflog. But it is not well publici
by jammycakes 13y ago
I'd just like to respond to all the people who are saying "Use the reflog" here.
Yes, you can recover lost commits using the reflog. But it is not well publicised that you can do this. Most tutorials do not mention it and most Git GUIs do not expose it. It is also not functionality that you expect to exist, so you are not likely to think to Google it. Unless you are an advanced Git user, your commits are indeed, to all intents and purposes, lost.
- jeltz 13y agoGood point, the reflog should be mentioned earlier in tutorials.
- jheriko 13y agoi don't think thats a fix at all. i still think it should be possible to revert a merge with a single command and no flags. the volume of questions about this on stack overflow and co. and the variety of answers, some of which i'm sure i tried and found not suitable, suggests that this is a real user experience problem. alternatively their should be a decent ui solution to hide this stuff and it should be packaged with git in some friendly installer somewhere (not SourceTree which although the best of the bunch I've tried, was of no help to me when i had this problem and has a huge stack of usability problems vs. e.g. p4v which frankly everyone should rip off because i'm sure its why perforce is still even a thing aside from support contracts...)
- jeltz 13y agoYou do not use the reflog to revert a merge. You do it to undo a messed up rebase, and I am not sure if that is something which you want to fix automatically. I think using the reflog here might be better, maybe with a shortcut to make it easier to reset to a point in it.
- steveklabnik 13y agoDoesn't the large number of people saying "use the reflog" indicate that amongst git users, they know that it exists?
- jammycakes 13y agoProbably. It's one of those things you learn as a Git user sooner or later -- though in most cases, not before a few heart-stopping moments and probably a bit of an injection of FUD into your team. Rather more worrying is the possibility of deleting history remotely with an injudicious git push --force. Some such remotes (coughGitHubcough) don't give you any access to the reflog on their end to sort things out. Git really needs to set receive.denyNonFastForwards and receive.denyDeletes to true by default.
- jheriko 13y agoyes, tbh this is the first time i have heard of the reflog. i extensively googled when i had the original problem which put me off using git