How to merge two Subversion commits into one

I use a GUI program to interact with our SVN repository. There's a lot of times when I go to commit ten different files, but accidentally only select one and commit it. I then have to make another commit with all my other changes.

Is there a way to merge those two "duplicate" commits together into a single commit with a single message in the tracking program?

It's pretty trivial, but I am curious whether it's possible.

Answers


It doesn't sound like they're "duplicate" commits.

It sounds like you have 10 files that you commit separately in two commits (if I understand correctly).

I don't know if you can "un-commit" the first file, but you could do another commit to "revert" the repo to where it was before you made the accidental commit. This would allow you to commit all ten files in the same revision.

I don't know how to do it with a GUI/IDE.

From the command line you could do it like this:

  • accidentally commit file A in revision 5000

  • create a patch to revert the commit:

    svn diff -r 5000:4999 > revert.patch

  • apply the patch:

    patch -p0 < revert.patch

  • now your repo is where it was before the accidental commit

  • now you can commit all ten files together

There are probably many ways (some easier) to do this. I'm sure this answer will be down-voted!


Need Your Help

How to avoid PHP memory exhaustion?

php memory

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 136753 bytes) in /home/alien/Desktop/1/scanner.php on line 166

What's a good library to manipulate Apache2 config files?

java python perl apache

I'd like to create a script to manipulate Apache2 configuration directly, reading and writing its properties (like adding a new VirtualHost, changing settings of one that already exists).