Combine local Git commits into one commit for git-svn

后端 未结 6 1275
野的像风
野的像风 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:52

    When I work with git-svn and want a series of git commits to show up as a single commit, I work on a topic branch and then do a non-fast-forward merge into master before dcommit-ing.

    First, rebase your branch against svn and make sure local master is up-to-date:

    git svn rebase && git push . remotes/trunk:master
    

    Then switch to master, merge and dcommit:

    git checkout master
    git merge  --no-ff -m "Message you want in svn"
    git svn dcommit
    

    This will show up as a single commit in Subversion but you will still have your local history that got you to that commit.

                                           +--- Merge commit
                                           V
    svn trunk  *---*---*-------------------*--- --- ---
                        \                 /
    topic branch         *---*---*---*---*
    

提交回复
热议问题