保护文件免受 svn 提交 [英] Protect files from svn commit

查看:49
本文介绍了保护文件免受 svn 提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,想象一个带有 log4j.properties 受版本控制的普通 web 应用程序.我不能将它添加到 svn:ignore 因为它是一个强制文件.如果我为开发进行自定义更改并且我不想提交它们,我必须注意意外提交.对于一个文件,它很容易处理,对于 3 个或更多文件,它变得令人毛骨悚然.

Hey, imagine a plain webapp with a log4j.properties which is under version control. I can't add it to svn:ignore because its a mandatory file. If i make custom changes for development and i don't want to commit them, i have to watch out for accidently commits. For one file it's easy to handle, with 3 or more files it becomes creepy.

有没有办法从 svn commit 中暂时禁用这些文件?所以它更容易提交?我正在使用 svnsubclipse.

Is there a way to disable these files temporary from svn commit? So its easiert to commit? I'm working with svn and subclipse.

推荐答案

处理此类情况的典型方法是执行以下操作:

The typical way to handle situations like this is to do the following:

  1. 复制该文件,以表明它是模板的名称
  2. 将模板提交到您的存储库
  3. 忽略原始文件

这样,您将拥有一个全新的副本,并且在部署期间您可以将文件从模板复制回真实文件.

This way, you will have a fresh copy lying around, and during deployment you can copy the file back from the template to the real file.

这样您就不会冒险对该文件进行错误更改,至少对于其他版本控制系统,您不会冒险有人检查文件并忘记锁定.

This way you don't risk committing bad changes to this file, and at least for other version control system, you don't risk someone checking the file out and forgetting the lock.

Subversion 没有办法表明一个文件是第一次提交的类型,所以当你将它添加到你的存储库时,你告诉 Subversion 跟踪该文件中的更改.除非您手动确保(或编写工具,或更改您的工具)永远不要提交对此文件的更改,否则 Subversion 不会帮助您.

There is no way in Subversion to indicate that a file is only-commit-first-time type of thing, so when you added it to your repository, you told Subversion to keep a track of changes in that file. Unless you manually make sure (or write a tool, or change your tools) to never commit changes to this file, Subversion will not help you.

这篇关于保护文件免受 svn 提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆