我想知道在提交期间是否可以忽略文件或部分代码。为了开发我的解决方案,我实际上使用了两台不同的计算机,每台计算机都使用自己的数据库连接字符串。
//Informations - DB
private const String _SERVER = "localhost";
private const String _DATABASE = "dbname";
private const String _UID = "";
private const String _PASSWORD = "";
//DB connection
public static MySqlConnection v_DBConnection;
public static void InititializeDB()
{
String v_ConnectionString = null;
MySqlConnectionStringBuilder v_MySqlConnectionStringBuilder;
try
{
v_ConnectionString = null;
v_MySqlConnectionStringBuilder = new MySqlConnectionStringBuilder();
v_MySqlConnectionStringBuilder.Server = _SERVER;
v_MySqlConnectionStringBuilder.UserID = _UID;
v_MySqlConnectionStringBuilder.Password = _PASSWORD;
v_MySqlConnectionStringBuilder.Database = _DATABASE;
//CONNECTION CHAIN
v_ConnectionString = v_MySqlConnectionStringBuilder.ToString();
v_DBConnection = new MySqlConnection(v_ConnectionString);
}
catch (Exception exception)
{
MessageBox.Show("InititializeDB fail due to:" + exception.ToString());
}
}
我想在提交期间忽略包含字符串的文件或排除部分代码(连接字符串)。
我尝试在我的.gitignore文件中添加包含我的连接链的文件,但我不确定,我不明白.gitignore文件的工作方式。
# Ignored files
DBConnection.cs