How to merge branch back to trunk in SVN with all commit history?

后端 未结 5 583
长情又很酷
长情又很酷 2021-01-30 17:32

How to merge branch back to trunk in SVN with all commit history? I know in Git I can use

merge -squash

Is there any equivalent command in SVN?

5条回答
  •  春和景丽
    2021-01-30 18:04

    To create a merge of a branch and create a single commit for each commit in the branch you can use a script, I'm using the following:

    #/bin/bash
    
    BRANCH="http://your branch url"
    
    for i in {1127..1138} # list of revisions
    do
      REV=$i
      echo $REV $BRANCH
      echo merged $REV from $BRANCH > tmps.commit
      svn log -c $REV $BRANCH >> tmps.commit
      svn up
      svn merge -c $REV $BRANCH ./
      svn commit -F tmps.commit
      rm tmps.commit
    done
    

    This will check out each revision you specify for the specific branch and perform a commit on the current directory, thus preserving each single change with the corresponding message.

提交回复
热议问题