Git: Manage Version Control on Multiple Single Files in a Repo

寵の児 提交于 2020-01-05 12:58:24

问题


I have a folder in which I keep and maintain around 20 or MySQL script files, and I am currently managing version control using Git. Since these scripts are somewhat independent of each other version-wise, I would like to set my repo to track versioning on each file individually. For example, consider that I have the following:

ImportTableA.sql  -> v1.5
ProcessTableA.sql -> v1.2
TableAReport.sql  -> v2.1

After a bit of time and some mods are made to two of the files, and they appear like so:

ImportTableA.sql  -> v1.7
ProcessTableA.sql -> v1.2
TableAReport.sql  -> v3.0

Since the versioning and tags in Git apply to the repo as a whole, is there an easy way to track the version on the individual files? The only way that I can think of is to create a separate repo for each file, but that would be rather cumbersome to manage.


回答1:


Just add a comment with a version at the top of each file.

Ok, I'm joking. You are correct: having a separate repo (BTW, you could use submodules to incorporate them you in your main repo) for every file is rather cumbersome.

If it is possible to move that scripts inside a DB and manage them there (making them stored procedures), then you can use a DB migration tool. There are plenty of them. Liquibase and Flyway to name some. You'll still need to store migrations in Git.



来源:https://stackoverflow.com/questions/37091970/git-manage-version-control-on-multiple-single-files-in-a-repo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!