Search code examples
gitgit-reflog

Best way to export a git repo and include reflog


I want to save and share a git repo with everything in it, including the current reflog state. Is the best way to do this just to zip up the .git directory? Or could there be a better way?


Solution

  • You can always use git bundle for this purpose.

    How to create git bundle?

    git bundle create mybundle --all
    

    Or choose other flags as well instead of the --all

    --branches[=<pattern>]

    Pretend as if all the refs in refs/heads are listed on the command line as <commit>.
    If <pattern> is given, limit branches to ones matching given shell glob.
    If pattern lacks ?, , or [, / at the end is implied.

    --tags[=<pattern>]

    Pretend as if all the refs in refs/tags are listed on the command line as <commit>.
    If <pattern> is given, limit tags to ones matching given shell glob.
    If pattern lacks ?, , or [, / at the end is implied.