问题
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