7

I've been using Git since 2014. So why do I STILL cringe whenever I have to revert commits or do a hard reset back to HEAD? What's going to disappear? What will remain? Will my entire Git history be vaporized? It's a total game of Russian Roulette to me. So, without the certainty level I want, I just do what feels safer...I grab the versions of the files I think are what I need and stick them back into my repo, then git status and commit the correct changes back in.

Comments
  • 2
    I always test before i commit, in the same session, if it fail, i ctrl-Z a million time and commit again

    Yeah i know...
    But it works 😁
  • 1
    I'm lucky to have a senior dev who is very proficient in git. They encourage me to learn new and better things when solving git issues, as a result I find handling git not scary at all anymore.

    Colleagues often come over to us, because merges broke their local repo and whatnot, never happens to us anymore.

    Personal recommendation, try using terminal for most git commands to really understand what specific commands achieve. Use clients like Fork when you need an overview for larger changes. Overall do smaller commits, not mountains of code. In a commit your code should have achieved some one thing. Not "[#issue][Fix][[Docu][Refactor] 3 km long commit message..."
    With environments like GitLab you can just squash commits afterwards anyway if need be.
Add Comment