git rebase on long-lived (remote) feature branches

前端 未结 2 1266
独厮守ぢ
独厮守ぢ 2021-02-14 12:23

Background: We use github for our project and I work on my own fork of our main repository. We use rebase instead of merge to avoid large merge commits.

<
2条回答
  •  情歌与酒
    2021-02-14 12:53

    If you're rebaseing, you will always have to --force when you push, because rebase rewrites history. That's simply how it works. Rewritten history isn't going to fast-forward on top of that same history by definition.

    The alternative is to merge instead of rebaseing. You could use your exact same workflow, except with merge instead of rebase, and you would not have to force push.

    If no one else is using your remote branch aside from you, then using --force isn't inherently bad. If other people are using the remote branch, you should probably use merge anyway.

提交回复
热议问题