CLI tool that copies commit history without reproducing the working tree
Project description
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
- Create and activate a virtual environment
- 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
- Clone this repo
- Create and activate a virtual environment
- Install the development dependencies:
$ pip install -r dev-requirements.txt
- Run the test suite:
$ pytest
Contributing
- Fork this repo
- Clone your fork into your local machine
- Follow steps in Development Setup but skip step 1
- Create your feature branch:
$ git checkout -b feature/some-new-thing
- Commit your changes:
$ git commit -m "Develop new thing"
- Push to the branch:
$ git push origin feature/some-new-thing
- Create a pull request
License
gitchm is available under the MIT License.
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
File details
Details for the file gitchm-0.1.0.tar.gz
.
File metadata
- Download URL: gitchm-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c5157acfc82bf24c1f7e6e78f37a3842ef2e79cb44d4b7aab0098d2285dd2d8 |
|
MD5 | 7132a571bf41611ffd2879131d02b593 |
|
BLAKE2b-256 | c59f712071a769bf771eaa74cbe526efb6e54d3b452466cd11ecfe93b4fdfb63 |