Skip to main content

Offline merge for git fast-import files

Project description

git fast-import merge

The git_fast_import_merge.py tool can read multiple archive files from 'git fast-export' and merge them into a single archive file for 'git fast-import' ordering the changes by date.

Optionally, (with -m) when switching the input file some 'merge' command is generated into the output archive file which makes for a history as if coming from multiple branches. This works fine if the different archives do not really represent parallel developments.

background

The tool was written for helper code that was shared in multiple different repositories. Each project had its own necessities to add some changes to the code which were then synchronized to the other projects.

Now it is possible to use git fast-export HEAD -- libcode.py libhelper.py > libcode1.fi.

Then merge them like ./git_fast_import_merge.py libcode1.fi libcode2.fi -o libcode.fi.

And the combined archive can be imported: cd libbcode; cat ../libcode.fi | git fast-import.

An example can be found here: https://github.com/gdraheim/tabtotext - extracted from https://github.com/gdraheim/timetrack-odoo and two report-tool archives.

updating a target repo

The basic execution assumes that you want to split off some files from a repo. So the target repository is fresh and new.

If you want to add patches later then you need to provide two pieces of information: the commit-hash of the target HEAD and the minimum DATE to consider from the inputs.

If you have a target repo then you can get that information like this:

  • git --no-pager rev-parse HEAD # hash-of-commit
  • git --no-pager show -s --format=%cI HEAD # date-of-commit

Provide these as --head=hash-of-commit --date=date-of-commit

If you say --into=./path/to/workspace then the tool will run these commands itself. And adding --import the the fast-import will run on the into-workspace right-away. However this is completely optional.

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_fast_import_merge-1.0.1316.tar.gz (14.8 kB view details)

Uploaded Source

File details

Details for the file git_fast_import_merge-1.0.1316.tar.gz.

File metadata

  • Download URL: git_fast_import_merge-1.0.1316.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.15

File hashes

Hashes for git_fast_import_merge-1.0.1316.tar.gz
Algorithm Hash digest
SHA256 3cd2702eff830d7171a87727ff61c1d608fd9353fe3251065e2780bf6a03e2ce
MD5 4428199cc81473f30732e73923b58941
BLAKE2b-256 fd6567b7e2cbcb7f72edf7510d7e4ea221cfcc8f6930c84ceda4fe773d19f731

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page