Skip to content

Instantly share code, notes, and snippets.

View jnareb's full-sized avatar

Jakub Narębski jnareb

View GitHub Profile
@jnareb
jnareb / django-git-switch-migrate.sh
Last active May 28, 2026 11:15 — forked from GabrielVidal1/django-git-switch-migrate.sh
Automatic django migration handling for git workflow
#!/bin/bash
# ==============================================================================
# Git Branch Switch with Safe Django Migrations
# ==============================================================================
# This script automates switching between Git branches in a Django project
# while handling database migrations safely.
#
# It:
# - Compares Django migrations between the current and target branches.
# - Reverts apps to the last common migration if migrations diverged.