Skip to main content

Sync filtered commits from private to public repository

Project description

git-sync-filtered

GitHub Repo stars Python versions License

A thin wrapper around git-filter-repo for syncing filtered commits from a private repository to a public repository.

Overview

git-sync-filtered clones a private repository, filters it to only include specified paths using git-filter-repo, and pushes the result to a public repository's sync branch. This enables maintaining a public subset of a private repository while preserving commit history.

Installation

uv (recommended)

uv tool install git+https://github.com/Merge-42/git-sync-filtered

uvx (run without installing)

uvx git+https://github.com/Merge-42/git-sync-filtered \
  --private git@github.com:org/private.git \
  --public git@github.com:org/public.git \
  --keep src \
  --keep docs

pip

pip install git+https://github.com/Merge-42/git-sync-filtered

Usage

git-sync-filtered \
  --private git@github.com:org/private.git \
  --public git@github.com:org/public.git \
  --keep src \
  --keep docs

Using a paths file

Create a file with paths to keep (one per line, lines starting with # are comments):

src
docs
README.md
git-sync-filtered \
  --private git@github.com:org/private.git \
  --public git@github.com:org/public.git \
  --keep-from-file paths.txt

Options

Option Description Default
--private Private repo path or URL Required
--public Public repo path or URL Required
--keep Paths to keep (specify multiple) Required
--keep-from-file File containing paths to keep -
--sync-branch Sync branch name upstream/sync
--main-branch Main branch name main
--private-branch Private branch to sync from main
--dry-run Show what would happen without making changes false
--merge Merge into main branch after sync false
--force Force push false

How It Works

  1. Clones the private repository
  2. Runs git-filter-repo to filter to only the specified paths
  3. Pushes filtered commits to the public repository's sync branch
  4. Optionally merges the sync branch into main

The sync branch can then be merged into main manually or with --merge.

Workflow

flowchart LR
    A[Private Repo<br/>private-branch] -->|clone & filter| B[git-sync-filtered]
    B -->|push| C[Public Repo<br/>sync-branch]
    C -->|"merge<br/>(manual or with --merge)"| D[Public Repo<br/>main-branch]

Requirements

  • Python 3.10+
  • git >= 2.36.0

Sponsored by Merge 42

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_sync_filtered-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_sync_filtered-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file git_sync_filtered-0.1.0.tar.gz.

File metadata

  • Download URL: git_sync_filtered-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for git_sync_filtered-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac89fbc32bbe347634135d46e3b6195e975eee581037c512b5cb85fc4916db66
MD5 79d588693c0cb532d66aa5d69aaeb9e9
BLAKE2b-256 fb42e860b4cce7eb780a8a85c9597ec177a9199aa29f5dc0cfb4e5171f8b4341

See more details on using hashes here.

File details

Details for the file git_sync_filtered-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: git_sync_filtered-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for git_sync_filtered-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8ae1b5c994c054138d7984e10c60b819326f6a0645d6e8eb64483bcdbce2cd9
MD5 a9edeb310f3969fb4116c072452f1581
BLAKE2b-256 19eccd31be27bdd2f9ed1c5b9dad589c15e446c978bd081d012fc037a2e76e1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page