this post was submitted on 08 Nov 2023
84 points (85.6% liked)

Programming

16240 readers
288 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] QuadriLiteral@programming.dev 1 points 8 months ago* (last edited 8 months ago)

And anyway... it's trivial to fix. If you still have the commit ID of the tip of the branch before the pull, go back to that. If not, look it up in the reflog. If that's too much of a hassle, list the commits you only have locally, stash any changes, reset to the origin/the_branch and cherry-pick your commits again and/or apply the stash.

I really embraced git once I understood that whatever I did locally, it's most of the time relatively easy to recover from cock-ups. And it's really difficult to lose work from the moment you've added it to a (local) commit or stashed it.

I do understand that git is daunting however, and there is plenty where I think the defaults are bad. Too often I've seen merge commits where someone merged a the remote of a branch into the local copy of the same branch, or even this on main. And once this stuff gets pushed it's neigh impossible to go back.