Subversion: prevent local modifications to one file from being committed?

前端 未结 13 553
名媛妹妹
名媛妹妹 2020-12-01 04:17

I have a Subversion working copy where I made some local modifications to one file. The modifications are only relevant to me, I do not want to commit them. (The version in

相关标签:
13条回答
  • 2020-12-01 05:10

    You can use a personal branch and switch that file for this effect. Like this:

     svn cp ^/trunk ^/branches/your_name -m "Creating a personal branch."    
     cd working_copy_of_trunk/sub_path/
     svn switch ^/branches/your_name/sub_path/your_file your_file
    

    Note that:

    1. You can check the switched status with the 'S' appearing on the fifth column with command: svn status
    2. You will never work on the branch, your working_copy_of_trunk still is synchronized against the repository trunk directory except the files you have switched, so whenever you commit changes on your_file, commits for that file will be done on your branch and not on the trunk.
    3. The copy have been done complete server side, and this is the recommended way with svn. Complete server side copy is instantaneous and will not spent extra space on the server. However, it is also recommended that people do not checkout the top directory containing trunk/ tags/ and branches/ but directly trunk/ otherwise all files will be duplicates locally when updating from this top dir. If this is the case rather subtitute the first command with :

      svn cp --parents ^/trunk/sub_path/your_file ^/branches/your_name/sub_path/your_file

      Finally if for any reason you do not want to copy your file elsewhere on your repository server, then you may still combine this approach with an external server and svn:external keywords (not really recommended).

    0 讨论(0)
提交回复
热议问题