Skip to main content

gitchm

A CLI tool that lets you replicate a git repo's commit history without reproducing the working tree. It works by creating commits in the destination repo using the details (author, committer, timestamp, and message) of commits from the source repo. Changes to the destination working tree are made only by writing the commit messages into an auto-generated text file. Files and directories from the source repo are not copied.

The current version of the tool allows you to:

  • Choose a local git repo as the source repo
  • Specify a local directory or git repo as the destination (or let the tool generate the destination for you)
  • Query commits by author, committer, and timestamp
  • Select which branch to copy commits from as well as which branch to copy commits into

Current Version

0.1.0

Requirements

Please see requirements.txt and dev-requirements.txt for full list of dependencies.

Installation

  1. Create and activate a virtual environment
  2. Run the following:
    $ pip install git+https://github.com/ralphqq/gitchm
    

Usage

Make sure that the virtual environment where you pip installed gitchm is activated. Then run:

$ gitchm

The tool then asks you to enter the following details:

  • Path to source repository: The absolute path to the directory containing the source repository. This is a required item, and the path must point to a valid git repo.
  • Path to destination repository: The absolute path to the destination repository. This is an optional item. If not provided, a new directory will be generated for you. The value can be a path to a non-existent directory (in that case, it will be created); a path to an empty or valid git repo; or a path to a directory that has previously been used as a destination repo.
  • Prefix to identify auto-generated destination directory: Prefix to be pre-appended to the auto-generated destination repo. This item is optional. If not provided, the string 'mirror-' will be pre-appended to the name of the source directory in order to create the destination folder.
  • Author name or email to query commits: All or part of the commit author's name or email address. This item is optional and is not case sensitive.
  • Committer name or email to query commits: All or part of the committer's name or email address. This item is optional and is not case sensitive.
  • Query commits before date/time: Date/Time string of the form yyyy-mm-dd HH:MM:SS (time component can be excluded). This item is optional.
  • Query commits after date/time: Date/Time string of the form yyyy-mm-dd HH:MM:SS (time component can be excluded). This item is optional.
  • Branch in source repo to get commits from: Name of branch in source repo. This is optional. If not provided, the currently active branch is used.
  • Branch in destination repo to copy commits into: Name of branch in destination repo. This is optional. If not provided, the currently active branch is used.

Development Setup

  1. Clone this repo
  2. Create and activate a virtual environment
  3. Install the development dependencies:
    $ pip install -r dev-requirements.txt
    
  4. Run the test suite:
    $ pytest
    

Contributing

  1. Fork this repo
  2. Clone your fork into your local machine
  3. Follow steps in Development Setup but skip step 1
  4. Create your feature branch:
    $ git checkout -b feature/some-new-thing
    
  5. Commit your changes:
    $ git commit -m "Develop new thing"
    
  6. Push to the branch:
    $ git push origin feature/some-new-thing
    
  7. Create a pull request

License

gitchm is available under the MIT License.

Metadata

Release files for gitchm 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitchm 0.1.0
File Size Uploaded
gitchm-0.1.0.tar.gz 11.8 kB Details

Release files / gitchm-0.1.0.tar.gz

Download URL gitchm-0.1.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1c5157acfc82bf24c1f7e6e78f37a3842ef2e79cb44d4b7aab0098d2285dd2d8
BLAKE2b-256 checksum
How to use checksums
c59f712071a769bf771eaa74cbe526efb6e54d3b452466cd11ecfe93b4fdfb63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page