git bundle create <filename> <branchname>

Bundles the commit history of <branchname> into a single file named <filename>.

This command is useful for capturing and sharing a branch’s history by packaging all its commits into a standalone file.

The bundle subcommand tells Git to work with a bundle archive, create specifies building a new bundle, <filename> is the output file that will contain Git objects and refs, and <branchname> selects the branch whose commits you want to include. When executed, this command collects all commits and objects reachable from the named branch and writes them into <filename>, producing a portable archive that can be later fetched or cloned.

You can bundle multiple refs by listing additional branch or tag names after <branchname>, or use --all to include every ref and --tags to include all tags. To inspect a bundle you created, use git bundle verify <filename>, and to pull its contents into a repository run git fetch <filename> <branchname>. Related commands include git archive for exporting a snapshot without history and git format-patch for generating a series of patch files.

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...