How to “unversion” a file in either svn and/or git

前端 未结 15 1307
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 19:58

It happens to me all the time. I accidentally version a file, I do not want to be versioned (i.e. developer/machine specific config-files).

If I commit this file, I

相关标签:
15条回答
  • 2020-12-22 20:41

    SVN version 1.5 supports removing/deleting a file from a repository with out losing the local file

    taken from http://subversion.tigris.org/svn_1.5_releasenotes.html

    New --keep-local option retains path after delete..

    Delete (remove) now takes a --keep-local option to retain its targets locally, so paths will not be removed even if unmodified.

    0 讨论(0)
  • 2020-12-22 20:43

    For SVN you can revert files you haven't committed yet. In TortoiseSVN you just right click the file in the commit window and choose Revert...

    On command line use svn revert [file]

    Don't know about GIT since I've never used it.

    0 讨论(0)
  • 2020-12-22 20:43

    Two simple steps in SVN:
    1. Add this directory in parent directory's svn:ignore property:

    svn propedit svn:ignore .  
    

    2. Remove directory:

    svn rm mydir
    

    3. Commit

    Please note that when other developers do a svn update, that directory will not get deleted. SVN just unversions it instead.

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