Combine local Git commits into one commit for git-svn

后端 未结 6 1276
野的像风
野的像风 2021-01-30 09:16

Currently, when I run git svn dcommit git creates a separate commit in SVN for every local commit I\'ve made since last syncing with SVN. Is there any way for

6条回答
  •  一个人的身影
    2021-01-30 09:58

    No, but you can squish all the commits together pretty easily. For the following example, I'm going to assume you're on the master branch corresponding to the remote trunk branch and that you want to squish all local commits together:

    git tag local # create a temporary tag
    git reset --hard trunk
    git merge --squash local
    git commit # write your single commit message here
    git svn dcommit
    git tag -d local # delete the temporary tag named local
    

    Instead of using a temporary tag you could also just use the reflog (i.e. use master@{1} in place of local)

提交回复
热议问题