在远程存储库上保留文件的基本版本,但在本地更新版本。

huangapple go评论58阅读模式
英文:

Keep a base version of a file on remote repository but an updated version locally

问题

我有2个文件,database.dbschema.sqlschema.sql 是使用以下命令在数据库中生成的:

sqlite3 database.db < schema.sql

然后 database.db 会在本地动态更新。我想要解决的问题是,我希望在远程仓库上的 database.db 版本仅包含在 schema.sql 中声明的表和表行。目标是避免在 database.db 中出现合并冲突,因为我们有多人在此存储库上工作,而且我们可能需要不同的数据库。

到目前为止,我只尝试将 database.db 添加到存储库的 .gitignore 中,但这没有起作用。

英文:

I have 2 files, database.db and schema.sql. schema.sql is generated in the database using the command:

sqlite3 database.db &lt; schema.sql 

The database.db is then updated dynamically locally. The question I want solved is that the version of database.db I want on my remote repository is the one that just contains the tables and table rows as declared in schema.sql. The goal here is that I don't want merge conflicts in database.db as we are multiple people working on this repository and we are likely to want to have different databases.

So far I have only tried adding database.db to the repository's .gitignore which doesn't work.

答案1

得分: 0

我想要解决的问题是,我希望在我的远程存储库上的database.db版本只包含在schema.sql中声明的表和表行。

然后使用两个不同的database.db文件:

  • 一个(database.gen.sql)被跟踪和推送,只包含在schema.sql中声明的表和表行:sqlite3 database.gen.sql < schema.sql
  • 一个(database.sql)从database.gen.sql复制,然后由开发人员私下修改,这意味着可以将其添加到.gitignore
英文:

> The question I want solved is that the version of database.db I want on my remote repository is the one that just contains the tables and table rows as declared in schema.sql

Then work with two different database.db files:

  • one (database.gen.sql) which is tracked and pushed, and just contains the tables and table rows as declared in schema.sql: sqlite3 database.gen.sql &lt; schema.sql
  • one (database.sql) which is is copied from database.gen.sql and then modified privately by developers, meaning this one can be added to the .gitignore.

huangapple
  • 本文由 发表于 2023年2月16日 17:41:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75470385.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定