https://github.com/coldfix/git-filter-tree
Utilities for fast git history rewrites using a parallelized tree-filter
https://github.com/coldfix/git-filter-tree
Last synced: 11 months ago
JSON representation
Utilities for fast git history rewrites using a parallelized tree-filter
- Host: GitHub
- URL: https://github.com/coldfix/git-filter-tree
- Owner: coldfix
- License: other
- Created: 2017-06-11T01:44:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-03T15:01:10.000Z (over 7 years ago)
- Last Synced: 2025-04-09T06:35:10.402Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 87.9 KB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES.rst
- License: COPYING.GPLv3.txt
Awesome Lists containing this project
README
git-filter-tree
---------------
|Tests| |License|
Utilities for efficient ``git`` history rewrites similar to (but ultimately
different from) ``git filter-branch --index-filter``.
The main conceptual difference to ``--index-filter`` is that any rewrite of a
tree must depend only on the tree itself, but not on the commit or its (new)
parents. This means that history rewrites can be split into
- rewriting trees
- rewriting commits
The tree rewrites can be **parallelized** and **cached**, which can make a
huge performance difference compared with ``--index-filter``.
See also `Large scale Git history rewrites`_.
Dependencies
~~~~~~~~~~~~
- python 3.6
- pygit2_ (tested with 0.25 and 0.26).
.. _pygit2: http://www.pygit2.org/
Usage
~~~~~
In general, in order to perform your own special rewrite, you will have to
implement a python module with a class deriving from the
``git_tree_filter.tree_filter.TreeFilter`` class. There are two example
modules in the source code, from which you may learn, or which may already fit
your needs.
unpack
~~~~~~
This module is designed to unpack all ``.gz`` files in the current repository.
However, it can be used to run arbitrary shell commands to all files of a
given extension. Usage:
.. code-block:: bash
python3 git_tree_filter unpack [EXT] [COMMAND] -- --branches --tags
The given command will be called for each distinct file in the repo's history
that has the specified extension – with the file content on its STDIN and must
output the replacement file content on its STDOUT.
For more details, see `git unpack: efficient tree filter`_.
rm
~~
Remove a few specific files (not dirs) from repository. Usage:
.. code-block:: bash
python3 git_tree_filter rm [PATH...] -- --branches --tags
dir2mod
~~~~~~~
This module is a helper to change the role of a subdirectory in a git repo to
a submodule.
For more details, see `git dir2mod: subdir to submodule`_.
dos2unix
~~~~~~~~
Convert the files with the specified extension to unix line endings, and
remove trailing whitespace from each line, as well as trailing blank lines,
while ensuring that the file ends with a newline. Usage:
.. code-block:: bash
python3 git_tree_filter dos2unix [EXT] -- --branches --tags
.. References:
.. _`git unpack: efficient tree filter`: http://coldfix.de/2017/06/11/git-unpack
.. _`git dir2mod: subdir to submodule`: http://coldfix.de/2017/06/13/git-dir2mod
.. _Large scale Git history rewrites: https://www.bitleaks.net/blog/large-scale-git-history-rewrites/
.. Badges:
.. |Tests| image:: https://img.shields.io/travis/coldfix/git-filter-tree/master.svg
:target: https://travis-ci.org/coldfix/git-filter-tree
:alt: Build Status
.. |License| image:: https://img.shields.io/badge/License-GPLv3+-blue.svg
:target: https://github.com/coldfix/git-filter-tree/blob/master/COPYING.GPLv3.txt
:alt: GPLv3