gitformat-bundle - Linux
Overview
gitformat-bundle is a command used to generate a bundle file, which can be used to transfer history across repositories. This is useful for migrating repositories or sharing changes with others.
Syntax
git format-bundle [options] [<paths>]
Options/Flags
- -v, –verbose: Display progress information during bundle creation.
- -d, –date-format=
: Specify the date format to use in the bundle. - -u, –update-shallow: Update shallow clones by including missing history.
- –commit-graft: Graft commits in the bundle to optimize bundle size.
- –parent-tracking: Include parent tracking information to handle renames and copies.
- –packfile=
: Bundle packfile into the specified file. - -o, –output=
: Save the bundle to the specified output file.
Examples
Create a bundle:
git format-bundle
Create a bundle with progress information:
git format-bundle -v
Bundle a specific branch:
git format-bundle origin/main
Bundle a range of commits:
git format-bundle SHA1..SHA2
Common Issues
- Bundle is too large: Optimize using
--commit-graft
or reduce the history range. - Unable to open specified output file: Ensure the file path is correct and accessible.
- Missing parent tracking: Enable
--parent-tracking
to handle renames and copies.
Integration
Transfer bundles between repositories:
git send-bundle <recipient> <bundle-file>
Unbundle and apply history:
git fetch <repository> <bundle-file>
Related Commands
- git fetch: Fetch and merge history from other repositories.
- git pull: Fetch and merge changes from the remote branch.
- git clone: Create a local working directory from a remote repository.