8

Accidentally ran

$ git reset --hard

On my 2 weeks worth of uncommited code.
Thankfully Intellij has a local history. 😥

Comments
  • 5
    You should commit more often.. Much more often xD
  • 5
    2 weeks without commits? HOW?
    I can't write more than 50 lines of code without commit.
  • 3
    Always use --soft to be safe 😎
  • 1
    @JS96 I commit after every change and if the thing I am working on is bigger (which it shouldn't be most of the time) I will use git commit --amend
  • 2
    Learn how to use the reflog. It could well be your saviour in the future.
  • 2
    @JS96 Laziness? XD this was way back then.

    You could say I learned my lesson the --hard way
  • 2
    alias greflog="git reflog --format='%C(auto)%h %<|(20)%gd %C(blue)%ci%C(reset) %gs (%s)'"

    alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

    Thank me later - Flies away
Add Comment