N
N
Nikita Gushchin2014-07-05 23:55:54
git
Nikita Gushchin, 2014-07-05 23:55:54

Prevent a file from being committed without removing it from the (git) repository?

Hello! We are developing an application in Java + Hibernate, and to access the database, each developer has his own login / password, which are recorded in the persistence.xml file:

show persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost/hibernate_test" />
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
            <property name="hibernate.connection.username" value="root" />
            <property name="hibernate.connection.password" value="" />
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        </properties>
    </persistence-unit>
</persistence>


It should be in the repository, but it needs to be made so that it cannot be changed. IDE - Idea

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Makarov, 2014-07-06
@iNikNik

You can use the merge strategy by specifying it in the .gitattributes file:
persistence.xml merge=ours

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question