Can I direct Git to treat file names starting with the same string as merge conflict?

Viewed 37

My git repo has a folder which contains database migrations scripts, named like this:

001 create a table.sql
002 add some data.sql
003 create another table.sql
...

There are never supposed to be two database migrations with the same number (because that would throw off a custom migration tool). For example, the following is not supposed to happen:

065 do something written by developer a.sql
065 something else written by developer b.sql

Is there any way to tell git to treat the above as a merge conflict, although the files have different names?

So basically, for the purpose of merging, git should treat both files as just 065.sql or even just 065. This would prevent an automatic merge and alert the developer that they're about to create a duplicate migration number.

Can this somehow be done in git, or will this require custom logic in my CI tool?

0 Answers
Related