Skip to main content
15 events
when toggle format what by license comment
Apr 16 at 16:00 comment added Arno man, you just saved me a day of work
Feb 14, 2023 at 20:25 comment added user6096790 This worked beautifully for me, however, "git reflog" surprisingly didn't show one of my recent fast-forward commits (that got lost with reset) and I needed "git reflog show --all"
May 26, 2021 at 4:33 comment added Amber K lifesaver. I was doing everything right committing and pushing as well. but seems I was behind from remote somewhere then I created a local branch from there later I realised the pushed were removed and commits were removed as well. only this showed me those last commits.
Oct 19, 2020 at 18:16 comment added Mukul Goel I had uncommitted changes and did git reset --hard HEAD. I had intelliJ open at that time. I got the changes back from intelliJ local history. Lifesaver. Hope it helps someone.
May 29, 2020 at 17:26 comment added Zaslam Recovering Lost Changes: If you accidentally lost uncommitted changes by git reset --hard, you can still recover lost changes from editor. Simply go to the file that lost changes and press ctrl-z to undo to state before hard reset. Very obvious way but sometimes it doesn't come to mind. Modern day editors also has log of all history of changes, from where you can get the changes.
Jun 20, 2018 at 9:16 comment added belka @Lethjakman Actually, you can't stash if you did git add your changes, I think. In those cases, git reset --hard would be a solution. If you have another solution than git reset --hard, I would love to see it ;)
Sep 2, 2015 at 11:55 comment added fidev If you haven't committed local changes and use git reset --hard HEAD the only way that you can get the changes back is if you still have an editor open and copy / paste the changes to new files.
Nov 11, 2014 at 18:41 comment added Snowcrash I prefer git reflog over git log -g simply because you get all the information on one line with sha1, HEAD info and commit messages all lined up. Much easier to read.
Sep 1, 2014 at 2:49 comment added Lethjakman ^ Just so you know you can stash your local changes before doing a reset --hard, and then just pop them and you lose nothing! Gotta love git.
Aug 4, 2011 at 5:05 comment added Michael Anderson There's one very important caveat with this.. and thats the "--hard" part. --hard blows away your local uncommitted changes. And you cant get them back like this (as they've not been committed anywhere). I believe there is nothing you can do about that :(
Oct 28, 2010 at 13:09 comment added Dan Moulding git log -g can be a little bit nicer way to view the reflog than git reflog.
May 21, 2009 at 6:17 comment added Jakub Narębski You can use "git reset --hard HEAD@{1}", no need for using SHA1. In most cases it should be enough to use "git reset --hard ORIG_HEAD".
Jan 29, 2009 at 5:35 history edited jfs CC BY-SA 2.5
removed prompt
Sep 17, 2008 at 16:21 vote accept Paul Wicks
Aug 22, 2008 at 4:36 history answered Brian Riehman CC BY-SA 2.5