Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

django

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/
like image 205
qg_java_17137 Avatar asked Nov 15 '17 12:11

qg_java_17137


3 Answers

This is a correct:

**/migrations/**
!**/migrations
!**/migrations/__init__.py
like image 92
Alex Ancco Cahuana Avatar answered Nov 15 '22 12:11

Alex Ancco Cahuana


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

like image 42
Alex Dragnea Avatar answered Nov 15 '22 11:11

Alex Dragnea


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
like image 42
Vincent Avatar answered Nov 15 '22 12:11

Vincent