Skip to main content

Extract subproject with just the relevant history

Project description

git-relevant-history

Extract software component from git repo into a new repo, taking complete relevant history with it.

Background

When software evolves, it is typical for a stable, established software component to be moved out of a git repository to facilitate more comprehensive reuse. One of the pain points of such a move would be losing git history, breaking the possibility of using git blame or git log to understand what led to the current design.

Historically git filter-branch was used for such extracting, and https://github.com/newren/git-filter-repo is a much faster alternative recommended by git now. Both tools work on a static list of path patterns to preserve, so file renames in the past are usually "cut point."

This tool also starts with "what is subcomponent in the current repo to extract?" but then analyzes the history of renames for any existing file. Such a list is used to create a list of patterns for git filter-repo so that effectively the old repo/component becomes standalone repo with a full history of every file, as long as git --follow catches the rename.

So from the extracted component perspective, the only history "lost" is one that would require manual analysis of commits to find file merging/splitting.

Help

Usage documentation for the tool is available via cmdline:

git-relevant-history --help :

Extract enough git history to facilitate git blame and have each line correctly annotated

Wipe all history that has no connection to the current state of the repository.

The resulting repository is a drop-in replacement for the old directory and has all history needed for typical git history use.

Usage:
  git-relevant-history [options] --source=<source_repo> --subdir=<subdir> --target=<target_repo>

Where git repo at <source_repo> would be processed into <target_repo>, in a way that only files starting with
<subdir> would be preserved.


Options:
  --only-specs         Only print git filter-repo specs file as expected by git filter-repo --paths-from-file
  -h --help            show this help message and exit
  -f --force           remove <target_repo> if exists
  -v --verbose         print status messages

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-relevant-history-1.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

git_relevant_history-1.0.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file git-relevant-history-1.0.0.tar.gz.

File metadata

  • Download URL: git-relevant-history-1.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.6.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for git-relevant-history-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ae23c8c1d88debbfd31d07b75f7c821a7371d84e10952b31e9855a77bf235a9f
MD5 94e9e91b469689d95bcb8bd40037854f
BLAKE2b-256 4c754b7c079057c0ee8f9e1924f2c003d647e945af1449a36654587df1096526

See more details on using hashes here.

File details

Details for the file git_relevant_history-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: git_relevant_history-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/1.6.0 pkginfo/1.8.2 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

File hashes

Hashes for git_relevant_history-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9de934373a3d8b0d963f468f8b09ca293574b3022717d84ad16157bb5f2e16da
MD5 889f431b4513163c15c44e1a06b909a5
BLAKE2b-256 8df19f389c9c136917f6abb37ccf94cf5f11987885327acb02bba2a4fca17c11

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