Skip to content

Instantly share code, notes, and snippets.

@abdulwahidgul24085
Last active January 26, 2026 15:09
Show Gist options
  • Select an option

  • Save abdulwahidgul24085/795e5538a24f796d3e285584b3e66cb5 to your computer and use it in GitHub Desktop.

Select an option

Save abdulwahidgul24085/795e5538a24f796d3e285584b3e66cb5 to your computer and use it in GitHub Desktop.
Delete all Migrations in Django project
# Bash script
find . -path "*/migrations/*.py" -not -path "./env/*" -not -name "__init__.py" -delete
# Powershell script
Get-ChildItem -Path . -Recurse -File | Where-Object { $_.FullName -match '\\migrations\\' -and $_.FullName -notmatch '\\env\\' -and $_.Name -ne "__init__.py" } | Remove-Item -Force
@abdulwahidgul24085
Copy link
Author

To not delete migrations in the env python packages. Crazy effect be careful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment