I force pushed. Without having pulled first. Lost 50h+ work. I was on the wrong machine(my laptop which doesn't have all my work saved)

I do have a backup, but it's at home and I won't be home till 1 day before the deadline.

I have contacted Gihub support hopefully they are willing to restore from backups.

  • 15
    I don't understand why force push is even an option. Do it right or don't do it. =/
  • 3
  • 4
    @duckWit sometimes it's necessary, like when you're trying to fix mistakes, or somebody else's fucked up commits, or reorganizing branches
  • 8
    @endor with such a high degree of danger, I'd avoid it if at all possible. To date I've been able to address all those things you mentioned without --force. /shrug
  • 3
    @endor try rollback commits ("revert" in Git terms). For none of your issues is force-pushing necessary.
  • 9
    If you don't pull you always run the risk of pushing incompatible code.

    Add to your pre-commit hook a pull request and have hit pull for you prior to comittng anything.

    You only ever have to deal with conflicts locally and not upstream breaking everyones code base.
  • 1
    @xzvf Ouch man.. feel your pain 😑
  • 3
    Thanks, all your hindsight is 20/20. I had branch protections in place, those just didn't work because I am the owner.......
  • 2
    @xzvf there's an option to include admins on branch protection...
  • 4
    try using reflog
  • 3
    Always use force-with-lease.

    It helps a lot!

Your Job Suck?
Get a Better Job
Add Comment