How can I force subversion to commit an unchanged file?

后端 未结 11 1120
孤街浪徒
孤街浪徒 2020-12-02 16:32

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

11条回答
  •  不知归路
    2020-12-02 17:22

    The reason why someone wants to commit unchanged file is misunderstanding of how to revert to a previous version of a file.

    For example, one may revert the file index.html in the revision 680 by just updating it to a revision in the past, e.g. 650:

    svn update index.html -r 650

    but it does not solve the problem, because:

    svn status -u index.html
            *      650   index.html
    Status against revision:    680
    

    svn clearly says that index.html is modified remotely and you can't commit it, i.e. it "thinks" that index.html is old and should be updated to a newer revision. So the next svn update will bring index.html back to the revision 680.

    To really revert a file you should merge it in reverse order:

    svn merge -r 680:650 index.html

    and then commit it svn ci -m "Reverted to r650" index.html

提交回复
热议问题