How can I force subversion to commit an unchanged file?

59,753

Solution 1

If you want the file contents to remain unchanged (meaning that you can't merely change whitespace as johnstok suggested) you can always change one of the properties on the file.

eg.

svn propset dummyproperty 1 yourfile
svn commit yourfile

That will perform a commit without having to change the file.

Just make sure that you don't use one of the special svn: properties. Anything else should be ok.


Edit: A number of other posters have asked why someone would want to do this - presumably the people who have marked this answer down have also had the same concerns.

I can't speak for the original poster, but one scenario where I have seen this used is when attempting to automatically synchronise activities on a Visual Sourcesafe repository with a subversion repository.

Solution 2

As to answer why one would like to do forced commits. I've seen cases where someone used a commit message that was wrong or unclear. It's nice if you can perform a forced commit, where you can correct this mistake. That way the updated commit message goes into the repository, so it won't get lost.

Solution 3

I frigged this by deleting then re-adding the offending file. Not the nicest way to do it, and it probably broke the revision history, but it suited my purposes.

Reason for wanting to do it: File was one of two executables built from the same source (with different #defines set). Minor change to source meant one had changed, one didn't. I wanted to record in the revision history that I had actually updated it to the latest version (even though there was no change).

Maybe Morten Holdflod Møller's point that "the file will still be a part of the new revision" would cover this indication, but I think a log of the unchanged file did not show comments for that revision.

Solution 4

If it's a text file just add some whitespace, such as a line feed.

Solution 5

Answering some people questioning this should be possible: for some reason svn doesn't recognizes differences between doc files, so I would like to force commit as well!

I am now moving documentation from static dirs, to svn. files are like UG_v1.2, UG_v1.3 etc. So just to keep history, I take 1.2, remove version from the filename and add and commit it to svn. Then I take the ver from the second one, copy it over the first one and want to commit it and newer version. File size and creation date changes (not mentioning what's inside the doc), but svn claims it's perfectly the same file and disallows me to commit. When I manually change the doc, svn sees the different. The heck? :>

Share:
59,753
pcorcoran
Author by

pcorcoran

I am a user-interface designer and engineer who specializes in web-based software.

Updated on January 12, 2022

Comments

  • pcorcoran
    pcorcoran over 2 years

    I want subversion to commit a file even if it's unchanged. Is there a way to do this?