我对GIT有问题。我遇到以下情况:
-> M1 -> M2 -> ............. Ma -> Mb -> Mc [master]
\ \
\ \ (merge 'master' to 'merge_branch' without commit 'Mc')
\ (create branch 'develop') \
\ /-> A -> A1 [merge_branch]
\ /
\ / (create branch 'merge_branch' from 'develop' at 'Da')
\ /
\ -> D1 -> ...........-> Da -> Db [develop]
我想重新设置分支“ merge_branch”(从提交“ Db”而不是“ Da”开始)
-> M1 -> M2 -> ................... Ma -> Mb -> Mc [master]
\ \
\ \ (merge 'master' to 'merge_branch' without commit 'Mc')
\ (create branch 'develop') \
\ /-> A -> A1 [merge_branch]
\ /
\ / (create branch 'merge_branch' from 'develop' at 'Da')
\ /
\ -> D1 -> ...........-> Da -> Db [develop]
在master分支上有很多提交(数千)。当我在'merge_branch'上并开始重新设置'git rebase development'时,我收到很多冲突。
我通常创建一个新分支,然后再次进行合并,但是我必须解决与以前解决的合并冲突。它比重新分支分支要快得多,但也很慢...
您是否有解决此问题的想法?
答案 0 :(得分:0)
我认为这里的问题是,您通过development创建了merge_branch,这比master领先。根据您的情况,您应该从主服务器分支此merge_branch:
git checkout master
# branch out from master and checkout, now you are on merge_branch
git checkout -b merge_branch
# force delete Mc on merge_branch
git reset --hard Mb
# attempt to merge with develop to catch up
git pull --rebase origin develop
取决于开发人员和开发人员之间的同步方式,您仍然可能会遇到很多合并冲突。但是,由于将“更快”的分支合并为“慢”的分支,因此您不应该遇到重复性冲突。