37

$ git push
> current branch is behind
$ git push -f

... 5mins later coworker is asking why his commits have disappeared.

Comments
  • 4
    The main issue came from me assuming the conflicts were due to a rebase I did from master into my branch. Didn't bother checking upstream commits.

    Lesson learned.
  • 1
    Our servers refuse to do that
  • 3
    > git push --force-with-lease

    With great power come long command lines!
  • 0
    Dude, common. Lazy.
  • 0
    @DLMousey we don't and honestly haven't had any issues in the past years when working with up to ~15 people. Anything bigger than that and branch protection is a must.

    The issue happened when working with another dev who lives in an opposite timezone, and I pulled, rebased, commited and force pushed in 5 mins. Within those 5 mins he got a new commit in there... which I didn't expected.
  • 0
    @CorruptComputer I am. Sometimes those PRs have merge conflict and can be cleanly fixed by rebasing master and force pushing the new history order.
Add Comment