It is better to use merge or rebase when two people are in the same branch of the remote function and have conflicts that will be passed to svn

My colleague and I have an energetic discussion about merger strategies, and I hope that we can get some information to help solve it.

tl: dr: If we use merge or redirect when transferring changes from the remote branch, so that we do not constantly review the resolution of the conflict.

  • svn: our main gold repository
  • trunk: git svn remote branch tracking. Used to change the git parameter to dommiting to subversion.
  • feature-branch: git remote branch, which combines the work of two colleagues on one function.
  • colleague 1: local branch of the first colleague.
  • colleague2: second affiliate colleague.

We use Sebastien Varette's excellent workflow from Is git-svn dcommit dangerous after merging into git? .

The problem that we get is that every time colleague1 reinstalls from svn (by reinstalling it in the trunk and then rebooting for colleague1 before moving to the functional branch when it is completed), it performs a branch function, conflicting with each other, done. The same conflict resolution needs to be repeated again and again - every time rebu svn workflow is executed.

Please note that we are using git rebase mirror un-3451 for this rebase.

My argument is that we should use git merge mirror un-3451 . I understand that this will produce a commit, which is marked as a merge of the two previous commits. Therefore, git would know not to use previous commits, but instead uses compilation.

My colleague, on the other hand, argues that using merge will make merging with svn much more difficult and prefers to use rebase. He believes that this is easy - unfortunately, he is not the one who resolves all conflicts. He claims that using squash fixes will have the same effect.

My argument is that merging has the same effect as squash, but includes marking the commits that were included.

State 1

 svn-trunk: A \ git-trunk: A' \ remote-feature: A'-----C \ / c1-feature: A'--C \ c2-feature: A'--D 

State 2

C conflicts with D in file 1 (F1). F1 resolves the conflict, so D becomes D '.

 git pull --rebase remote feature git add F1 git rebase --continue git push 

Fixation Schedule:

 svn-trunk: A-----B \ \(svn rebase) git-trunk: A'----B' \ remote-feature: A'-----C---------D' \ / \ / c1-feature: A'--C \ / (git push) \ \ / c2-feature: A'-------C--D' 

State 3

Now, colleague1 wants to pull the changes from svn-trunk:

 git checkout trunk git svn rebase 

and then reinstall them to c2 function

 git checkout feature-branch git rebase trunk 

Babas puts B1 on a c2 function and then C and then captures D 'and forces the same conflict resolution to become D' '

Fixation Schedule:

 svn-trunk: A--------B \ \(svn rebase) git-trunk: A'--------B' \ \ remote-feature: A'-----C--\-----D' \ / \--\--\ \ c1-feature: A'--C \ \ \ \ \ \ \ c2-feature: A'----------B'-C--D'' 

Every time a git checkout trunk; git svn rebase; git checkout feature-branch; git rebase trunk; git push remote loop occurs git checkout trunk; git svn rebase; git checkout feature-branch; git rebase trunk; git push remote git checkout trunk; git svn rebase; git checkout feature-branch; git rebase trunk; git push remote git checkout trunk; git svn rebase; git checkout feature-branch; git rebase trunk; git push remote , all conflict resolution should be done over and over again.

Questions

  • if you reinstall from svn, click on the remote branch, ask colleague2 to push some commits to the remote branch, and then later, colleague1 will merge with the remote branch, as a result of the merge, svn commits will be mentioned (and therefore cause a problem in subsequent permutations) .
  • Which is better in the above scenario: rebase or merge?
  • Will there be a more functional reerere function?

Thank you very much!

+4
source share
2 answers

First, I omit identical nodes and reorganize the nodes so that each branch has its own head as the right-most node, in order to better represent the tree. (correct me if the tree is wrong). My comments are in bold.

State 1

 svn-trunk: A \ git-trunk: A' \ c1/remote-feature: \----C \ \ \ c2-feature: --D 

Then D was reset as D 'to C. This is the easy part (to understand). Perhaps it was a shovel (or "simple" D) if there was no conflict.

State 2

C conflicts with D in file 1 (F1). F1 resolves the conflict, so D becomes D '.

 svn-trunk: A-----B \ \(svn rebase) git-trunk: A'----B' \ \ c1-feature: C \ c2/remote feature: D' 

Now we move on to the difficult part.

State 3

Now, colleague1 wants to pull the changes from svn-trunk:

 git checkout trunk git svn rebase 

and then reinstall them to c2 function

 git checkout feature-branch git rebase trunk 

Babas puts B1 on a c2 function and then C and then captures D 'and forces the same conflict resolution to become D' '

Fixation Schedule:

 svn-trunk: A \ git-trunk: A'----B' \ \ \ \ c1-feature: C \ \ \ remote feature: D' \ \ c2-feature: C----D'' 

I find it difficult to understand the transition from state 2 to state 3, since your comments do not seem to match the state of the graph (which is more like trying to reinstall c2 / remote function on the trunk (in B '), with the result of c2. I believe what you really wanted:

Desired state 3

 svn-trunk: A-----B \ \(svn rebase) git-trunk: A'----B' \ \ c1-feature: C \ c2/remote feature: D' 

, which means that you could not reload A'-CD 'to A'-B' without requiring further resolution of the conflict over D ', which is strange because this should not happen (I tried to reproduce this on a git-svn repo and it works as intended). Strictly speaking, this is not even a git-svn problem, since you are simply rewriting one git branch against the other. It looks like you are trying to rebalance correctly, so I can only assume that some information is missing, i.e. What I described is not what really happened.

0
source

I am a colleague 2.

My position is that frequent reinstallations from SVN into our branch of functions that cause pain. Every time we reload, a set of changes is played over the SVN changes. Actual conflicts are in our updated changeset.

Ideally, we would cut our set of changes into a single commit so that conflicts that occurred in the set of changes are resolved and should not be resolved again after another reboot.

Alternatively, we can expect to reinstall from SVN until the function branch is ready and ready.

I’m not sure that the transition from reinstallation, when we reach for the merger, will improve our process in general. The painful point is frequent reinstallations from SVN, and I don’t think that merging between the function branch and our local branches will improve SVN reloading.

0
source

Source: https://habr.com/ru/post/1385572/


All Articles