Rebasing and what does one mean by rebasing pushed commits

前端 未结 4 415
予麋鹿
予麋鹿 2020-11-29 15:28

It is often said that, you should not rebase commits that you have already pushed. What could be meaning of that?

4条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 15:30

    The ProGit book has a good explanation.

    The specific answer to your question can be found in the section titled "The Perils of Rebasing". A quote from that section:

    When you rebase stuff, you’re abandoning existing commits and creating new ones that are similar but different. If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours.

    Update:
    Based on your comment below, it sounds like your are having difficulty with your Git workflow. Here are some references that may help:

    • The gitworkflows man page: See "Merging Upwards" and "Topic Branches"
    • ProGit: See "Private Managed Team"
    • Jarrod Spillers blog: See "git merge vs git rebase: Avoiding Rebase Hell"

提交回复
热议问题