• zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I was curious about why people would run git push --force on a shared branch. Some reasons people gave were:

    • they’re working on a collaborative feature branch, and the feature branch needs to be rebased onto main. The idea here is that you’re just really careful about coordinating the rebase so nothing gets lost.

    A safer solution would be to make a new branch and do the rebase on it instead, that way the shared branch won’t be impacted. You might still lose changes if they’re pushed after merging to main but that’s not really rebases fault. You can always cherry pick or something then from the original un-rebased branch (hopefully without any merge issues…)