Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. PostgreSQL
  3. pgsh

pgsh

MITJavaScriptv0.12.1

A CLI tool that enables Git-like branching for PostgreSQL databases to simplify local development workflows.

Visit WebsiteGitHubGitHub
649 stars16 forks0 contributors

What is pgsh?

pgsh is a command-line tool that streamlines PostgreSQL database management during local development. It allows developers to branch, clone, and switch between database states effortlessly, reducing the pain of migrations and context switching by managing connection strings in .env files.

Target Audience

Developers working on PostgreSQL-backed applications who use environment-based configuration (like dotenv) and need to manage multiple database states locally, especially those using knex for migrations.

Value Proposition

Developers choose pgsh for its Git-like branching workflow for databases, which simplifies context switching and feature isolation, and its seamless integration with knex migrations and .env-based configuration, adhering to Twelve-Factor App principles.

Overview

Branch your PostgreSQL Database like Git

Use Cases

Best For

  • Managing multiple database branches for parallel feature development in PostgreSQL projects
  • Simplifying database context switching during local development with automated .env updates
  • Integrating and streamlining knex migration workflows with user-friendly commands
  • Cloning databases to create isolated testing or experimentation environments
  • Automating PostgreSQL dump and restore operations via command-line tools
  • Enforcing environment-based configuration and Twelve-Factor App practices in database management

Not Ideal For

  • Projects using non-PostgreSQL databases (e.g., MySQL, MongoDB)
  • Teams that manage database configurations statically or without .env files
  • Development environments with fully containerized, automated database provisioning (e.g., using Docker Compose with ephemeral databases)
  • Applications relying heavily on GUI database tools or ORMs with built-in migration management (e.g., Django ORM, Laravel Eloquent)

Pros & Cons

Pros

Git-Like Database Branching

Enables creating and switching between database branches similar to Git, as shown in the branching model docs, which simplifies parallel feature development and reduces context-switching pain.

Automatic .env Management

Automatically updates database connection strings in .env files when switching branches, adhering to Twelve-Factor App principles and reducing manual configuration errors.

Knex Migration Facilitation

Provides user-friendly commands for knex migrations (e.g., up, down, validate), making migration workflows more intuitive and less error-prone, as highlighted in the command reference.

Efficient Cloning and Snapshots

Uses PostgreSQL's native tools like pg_dump for cloning and dump/restore operations, ensuring reliable and isolated environments for testing or experimentation.

Cons

PostgreSQL-Only Limitation

Exclusively supports PostgreSQL, so it's useless for projects using other databases, and the README doesn't mention plans for broader database support.

Dependency on Specific Setup

Requires projects to use .env files and environment-based configuration; the README notes limited maturity for non-JavaScript ecosystems, making it less flexible for heterogeneous tech stacks.

Risk of Irreversible Data Loss

Commands like 'pgsh destroy' can permanently delete databases, and while a blacklist option exists, it requires manual configuration and careful oversight, posing a risk in collaborative environments.

Frequently Asked Questions

Quick Stats

Stars649
Forks16
Contributors0
Open Issues17
Last commit3 years ago
CreatedSince 2019

Tags

#psql#devops#dotenv#migrations#git#knex#postgresql#cli#local-development#database-tools#database-branching

Built With

P
PostgreSQL
k
knex
N
Node.js

Links & Resources

Website

Included in

PostgreSQL11.8k
Auto-fetched 9 hours ago

Related Projects

pgclipgcli

Postgres CLI with autocompletion and syntax highlighting

Stars13,374
Forks610
Last commit4 days ago
AtlasAtlas

Declarative schema migrations with schema-as-code workflows

Stars8,709
Forks373
Last commit4 days ago
Schema SpySchema Spy

Database documentation built easy

Stars3,717
Forks357
Last commit6 months ago
pg-schema-diffpg-schema-diff

Go library for diffing Postgres schemas and generating SQL migrations

Stars879
Forks82
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub