(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon

How to version ELT transformations with Git: step by step

João Barros 26 de November de 2026 4 min read

Versioning ELT transformations is essential for traceability, collaboration and regression recovery. This tutorial shows how to integrate Git with ELT pipelines to version SQL and Python scripts, manage branches and promote changes safely.

Prerequisites

  • Git account (GitHub, GitLab or Azure Repos) and Git installed locally.
  • Code editor (VS Code recommended) and access to the project repositories.
  • ELT pipelines that execute SQL/Python scripts (e.g.: Azure Data Factory, Databricks, Airflow) and permissions to point to artifacts in the repository.

Step 1: Structure the repository for ELT

Organizing files makes versioning and reviews easier. Create a simple tree that separates ingestion, transformation and utilities scripts. Keep examples, a README and a policy file.

# Estrutura sugerida
elt-repo/
  README.md
  ingestion/
    load_raw.sql
  transforms/
    2026-11_transform_customers.sql
    transform_orders.py
  tests/
    schema_checks.sql
  ci/
    pipeline-config.yaml

Step 2: Write clear, atomic commit messages

Each commit should be small and include a message that explains the "why" of the change. Avoid commits that mix multiple functional changes. Use conventions like feat:, fix:, docs:, refactor: to ease review.

# Exemplo de fluxo de trabalho local
git checkout -b feat/transform-customers-202611
# editar transforms/2026-11_transform_customers.sql
git add transforms/2026-11_transform_customers.sql
git commit -m "feat: adicionar transformação para customers com SCD tipo 2 simplificado"
git push origin feat/transform-customers-202611

Step 3: Implement Pull Request/Merge Request review

Use Pull Requests (PR) to review code before promoting to the main branch. Configure reviewers, describe the impact on the ELT pipeline and include unit tests or validation queries. This prevents regressions in production.

# Exemplo de checklist no PR
- Descrição da alteração e tabelas afetadas
- Testes aplicados em tests/
- Atualização de documentação em README.md
- Aprovação de 1-2 reviewers

Step 4: Integrate CI to automatically validate transformations

Set up a CI pipeline that runs basic checks for each PR: SQL/Python linting, lightweight integration tests (e.g.: run scripts against a test environment) and schema validation. The goal is to block PRs that break the pipeline.

# pipeline-config.yaml (exemplo simplificado)
steps:
  - name: lint
    run: sqlfluff lint transforms/
  - name: unit-tests
    run: pytest tests/
  - name: dry-run
    run: ./ci/run_dry_run.sh --scripts transforms/ --target test-db

Step 5: Manage releases and promote to production

When the PR is accepted, use tags or release branches to promote artifacts. For example, create a release/v1.2 branch that is pointed to by the production pipeline. Maintain a simple CHANGELOG with impact and rollback instructions.

# Criar release e tag
git checkout main
git merge --no-ff feat/transform-customers-202611
git tag -a v1.2 -m "Release v1.2: novas transformações customers"
git push origin main --tags

Step 6: Track which version was executed in the ELT pipeline

Record the commit hash or tag in the pipeline execution artifact. That way it is possible to reproduce transformations and diagnose regressions. Store metadata in the orchestration system or in an audit table.

# Exemplo: gravar commit hash numa tabela audit_transform_runs (pseudo-SQL)
INSERT INTO audit_transform_runs (run_id, script_path, git_commit, started_at)
VALUES ('run-20261126-001', 'transforms/2026-11_transform_customers.sql', 'abc123def', CURRENT_TIMESTAMP);

Verify the result

Confirm that: (1) PRs require approval and CI passes, (2) tags/releases match what was promoted to production, (3) the audit_transform_runs table contains the git_commit used in execution. Perform a simulated rollback: revert to an old tag and verify the pipeline reproduces the expected result.

Conclusion

Versioning ELT transformations with Git improves collaboration, auditability and recoverability. Next steps: automate rollback in pipelines and integrate deeper data tests (data contracts). Tip: start small—implement atomic commits and lightweight CI, and evolve as you gain confidence.