12
fleka
6y

Hitting hard reset on git instead of soft. Lost two days of work.

Comments
  • 6
    Don't do two days without pushing to remote repo
  • 5
    Learned the lesson a while ago and the ‘hard’ way.
  • 2
    Take Salt'n'Pepa's advice, and push it real good
  • 4
    Have you tried git reflog? If you've committed or staged your changes you should be able to recover them.
  • 0
    @fboers nope. Wasn’t aware of it. Thanks for the advice
  • 2
    Do you even push bro?
  • 0
    This is also why we can make branches on the local repo. Keep all this history you want. Commit often. When ready to push, branch a second time, squash your changes, then merge into the desired branch. This way you have history, have a backup branch in case you screw up the squash, and ideally don't lose your work.
  • 2
    Luckily my IDE has its own vcs which allows me to undo changes on disk, saved my ass multiple times 😅
  • 0
    @thumbcore I appreciate your advice, this is how I work in the past several years. This happened when I started with git. Just wanted to share with the others.
    So I had two days of commits without any push, wanted to soft reset in order to remove and change something before I push and instead I hit hard reset. It was me not being careful enough, and they have but a better distinction between the two options. Was using SmartGit at that time.
  • 1
    Git is fantastic for what it is, but most dev teams actually only need this

    http://ifuelsys.com/wp-content/...

    and with git, they instead get this

    https://upload.wikimedia.org/wikipe...
  • 1
    @mksana gauges go only to 1.5 MW. Too small.
  • 1
    JetBrains' IDEs supports a local history. So I can even restore all the hard resetted code outside of git.
Add Comment