Metadata-Version: 2.1
Name: great-scott
Version: 0.1.4
Summary: Automatically reverses Django migrations when changing git branches
Home-page: https://github.com/goreckim/great-scott
License: MIT
Keywords: Django,migrations,git
Author: Marcin Górecki
Author-email: marcin.gorecki@hey.com
Maintainer: Marcin Górecki
Maintainer-email: marcin.gorecki@hey.com
Requires-Python: >=3.8,<4.0
Classifier: Environment :: Console
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Version Control :: Git
Classifier: Topic :: Utilities
Project-URL: Repository, https://github.com/goreckim/great-scott
Description-Content-Type: text/markdown

<div align="center">

# great-scott

`great-scott` automatically reverses migrations in a Django project when switching between Git branches.

[Installation](#installation) •
[Usage](#usage) •
[Removing Git hooks](#removing-git-hooks)

![doc](img/doc.jpeg)

</div>


## Installation

1. **Install the tool**

   Via [uv](https://github.com/astral-sh/uv) (recommended):
   ```sh
   uv tool install great-scott
   ```

   Via [pipx](https://github.com/pypa/pipx):
   ```sh
   pipx install great-scott
   ```

   Or directly into the project's virtual environment:
   ```sh
   python -m pip install great-scott
   ```

2. **Set up Git hooks**

   From the project directory, run:
   ```sh
   great-scott install
   ```


## Usage

Migrations are reversed automatically when switching branches:

```sh
$ git checkout main
Switched to branch 'main'
👀 Looking for migrations to reverse on mig-test...
⚠️ reversing migrations for importer (up to 0015)
⚠️ reversing migrations for permissions (up to 0018)
⚠️ reversing migrations for subscriptions (up to 0044)
I have reversed migrations for 3 apps!
```

> **IDE users:** If you switch branches via PyCharm, VSCode, or another IDE's Git integration, make sure the IDE is configured to use the correct Python environment - otherwise automatic migration reversal may not trigger.


## Removing Git hooks

From the project directory, run:
```sh
great-scott uninstall
```

