How to add all of the migrations/ to git .gitignore file in django?

Viewed 11696

In my Django project, I have many migrations directory, I want to add to my .gitignore file:

Because they are under each app directory, I do not want to add every one.

How can I add all the migrations directories in it?

Now in it only like this:

.idea/
4 Answers

This is a correct:

**/migrations/**
!**/migrations
!**/migrations/__init__.py

You can add "**/migrations/*" to your .gitignore file, this will add all folders and it's contents called migrations to git ignore. More informations here

You can add a new line in .gitignore file like so -

**/migrations/

if the migrations folder is multiple level deep add the same in the .gitignore like the following

**/**/migrations

You must not do this. Migrations are part of your code base, and must be committed and deployed with it.

Related