Rebasing remote branches in Git

前端 未结 4 1286
甜味超标
甜味超标 2020-12-12 09:41

I am using an intermediate Git repository to mirror a remote SVN repository, from which people can clone and work on. The intermediate repository has it\'s master branch reb

4条回答
  •  伪装坚强ぢ
    2020-12-12 10:25

    It comes down to whether the feature is used by one person or if others are working off of it.

    You can force the push after the rebase if it's just you:

    git push origin feature -f
    

    However, if others are working on it, you should merge and not rebase off of master.

    git merge master
    git push origin feature
    

    This will ensure that you have a common history with the people you are collaborating with.

    On a different level, you should not be doing back-merges. What you are doing is polluting your feature branch's history with other commits that don't belong to the feature, making subsequent work with that branch more difficult - rebasing or not.

    This is my article on the subject called branch per feature.

    Hope this helps.

提交回复
热议问题