A
A
Alexander Leyba2019-06-17 11:49:31
Django
Alexander Leyba, 2019-06-17 11:49:31

How to properly add migration files to gitignore?

Tell me how to make gitignore in such a way that it would not upload migration files?
At the moment I have this:
*kapvenv
*.idea
*my_settings.py
*__pycache__
*media
*/migrations/*
pycache/
*/pycache/
*.py[cod]
But with this arrangement, my migrations folder disappears, I need to hide only the migration files themselves by type 0001_initial.py

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
marazmiki, 2019-06-17
@marazmiki

That's right - no way. Migrations are an integral part of the project and should not be excluded.

D
Decadal, 2019-06-17
@Decadal

Git does not index empty folders by default. Place a .gitkeep or .gitignore file with content in the migrations folder

*
!.gitignore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question