Git:管理Repo中多个单一文件的版本控制 [英] Git: Manage Version Control on Multiple Single Files in a Repo

查看:118
本文介绍了Git:管理Repo中多个单一文件的版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件夹,我保存并维护大约20个或MySQL脚本文件,而且我目前使用Git管理版本控制。由于这些脚本在版本上相互独立,因此我希望将我的repo设置为分别跟踪每个文件的版本控制。例如,考虑我有以下几点:

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

经过一段时间以及一些mod对两个文件进行了修改,看起来像这样:

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

由于Git中的版本控制和标签作为一个整体适用于回购, easy 方式来跟踪单个文件的版本?我能想到的唯一方法是为每个文件创建一个单独的回购站,但这样管理起来会比较麻烦。 解决方案

p>只需在每个文件的顶部添加一个版本的注释。



好吧,我在开玩笑。你是正确的:有一个单独的回购(顺便说一句,你可以使用子模块将它们合并到你的如果可以将这些脚本移动到数据库中并在那里管理它们(使它们成为存储过程),那么您可以使用数据库迁移工具。有很多。 Liquibase Flyway 命名一些。您仍然需要将迁移存储在Git中。


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.

这篇关于Git:管理Repo中多个单一文件的版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆