Is it possible to make git svn dcommit result in a single svn commit?

前端 未结 3 1978
盖世英雄少女心
盖世英雄少女心 2020-12-22 22:19

According to the manual, git dcommit “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is,

3条回答
  •  星月不相逢
    2020-12-22 22:56

    The command git rebase -i can do this, and more. This command is extremely powerful, so it's good to make friends with it.

    The syntax is: git rebase -i . This brings up your text editor, with options (and instructions) for modifying all the commits up to (not including) the given ID.

    For example, to modify the previous 5 commits, you can do this:

    git rebase -i HEAD~5

    Or if your SVN branch is called "svn/trunk", then this syntax is good too:

    git rebase -i svn/trunk

    Then a text editor window will pop up. To squash everything, change the first word of every line after the first from "pick" to "squash" (If this sounds confusing- it will make more sense when you see it). Then save and close the editor. You'll then have a chance to edit the commit message for the squashed commit.

    Among the other things you can do with git rebase -i, are reordering commits, squashing commits in different ways, and removing commits.

    I use this command constantly; it's a killer feature of Git.

提交回复
热议问题