I don't know about Django but in Rails† the migrations are numbered with a timestamp (in the filename itself), instead of a sequential number, precisely to avoid (git) merge conflicts. Then they're run in alphabetical order. There's a dedicated table to record which migrations have been run already.
Thanks! Coincidentally one of the first articles I wrote for my blog was about compile-time checking of table/column names:
https://david.rothlis.net/d/templates/
(Just something I was messing around with, not anything I ever used in production.)
† 10 years ago, anyway.