How to create reflogs information in an existing bare repository

As you might have known that by default, git doesn’t enable reflog updates for new bare repositories. The problem is, I have a long history repository but it was created before I set the flag “logAllRefUpdates” on, and now I want that information for another application to work.

How can I achieve that with minimal changes made to the existing repository. A very simple solution is pushing a new commit which I don’t want to (!) 🙂

  • How do I clone a job in jenkins?
  • Git revert creates conflict “deleted by us” due to rename
  • git pushing submodule
  • Why does git show a conflict between two apparently identical added files?
  • Permanently remove a single old commit in Git
  • How to use version control on a remote development server?
  • when you have secret key in your project, how can pushing to GitHub be possible?
  • Use “git revert” to back-out a change adding a line?
  • SVN trunk overwritten by old release. Project and trunk folder have now different histories
  • Can MKS Integrity integrate with other source control tools? (SVN, Git…)
  • How do I fork an empty repository on github?
  • git-svn --ignore-paths
  • One Solution collect form web for “How to create reflogs information in an existing bare repository”

    The reflog is a relatively simple file format. Here’s an example:

    ] cat .git/logs/HEAD|sed 's/\t/<TAB>/'
    0000000000000000000000000000000000000000 5cfe4256d98af22a570c78c5e3048391a90f5f98 Joe User <> 1306427954 -0400<TAB>clone: from git://

    You can manually construct appropriate reflogs by following the same format:

    previous-ref-or-zero new-ref User Name <user@email> unix-timestamp timezone\tmessage

    Just create one of these for each ref. You can probably do this directly with git for-each-ref with an appropriate format string (thanks, Chris!)

    Git Baby is a git and github fan, let's start git clone.