简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM