Re: create reflog for reflog-less ref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2020 at 02:39:09AM +0000, brian m. carlson wrote:

> There is the option core.logAllRefUpdates, which has the value "always"
> in more modern versions of Git.  The documentation says,
> 
>   If [the option is set to always, then a missing reflog is
>   automatically created for any ref under refs/.
> 
> Now, that assumes that you want reflogs for all your refs, but there's
> really not much downside to having a reflog and not using it.

The current rule is actually to append to any reflog that already
exists, or to consult core.logAllRefUpdates when deciding whether to
create one that doesn't exist. So I think setting a one-shot config
variable like:

  git -c core.logAllRefUpdates=always update-ref refs/foo/bar ...

would create the reflog, and then any subsequent updates (even without
that config set) would append to it.

You can also do this:

  mkdir -p .git/logs/refs/foo/
  touch .git/logs/refs/foo/bar
  git update-ref refs/foo/bar ...

but I wouldn't recommend it. When we eventually move to supporting other
ref backend formats, they won't necessarily store the logs in the same
way.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux