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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for git-relevant-history-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae23c8c1d88debbfd31d07b75f7c821a7371d84e10952b31e9855a77bf235a9f |
|
MD5 | 94e9e91b469689d95bcb8bd40037854f |
|
BLAKE2b-256 | 4c754b7c079057c0ee8f9e1924f2c003d647e945af1449a36654587df1096526 |
Hashes for git_relevant_history-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de934373a3d8b0d963f468f8b09ca293574b3022717d84ad16157bb5f2e16da |
|
MD5 | 889f431b4513163c15c44e1a06b909a5 |
|
BLAKE2b-256 | 8df19f389c9c136917f6abb37ccf94cf5f11987885327acb02bba2a4fca17c11 |