git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Tao Klerks <tao@klerks.biz>
To: git <git@vger.kernel.org>
Subject: Keep reflogs for deleted (remote tracking) branches?
Date: Tue, 8 Mar 2022 12:27:38 +0100	[thread overview]
Message-ID: <CAPMMpog=qBwLrxss_ci6ZMM+AjbdrF8tszXLW7YH1Zqr+m7mPQ@mail.gmail.com> (raw)

Hi folks,

I have a practical question in case I missed something.

Imagine a small team (10ppl) working on a single centralized repo, in
github for example. They regularly create new branches, and typically
delete them eventually - after merging, or at other times when
branches were a dead end or whatever. The members of this team all
have a "simple" git remote configuration, the result of a "git clone"
with no special configuration. One exception is that they have set
"fetch.prune" to "true", because otherwise remote branches that have
been deleted (in the context of completed merges, or arbitrarily by
other team members) accumulate locally and having to explicitly prune
them from time to time is a pain. Every time someone says "why do I
still see these branches in my repo?", someone else replies "oh, just
run 'git config fetch.prune true'".

Now, one day someone deletes a branch accidentally from the server,
and the sole author of that branch has gone on vacation (or has an IT
failure, or has left the company, or whatever). Other team members
have seen this branch go by, it's appeared in their "fetch" output,
but no-one remembers checking it out, so it's not in their main
"HEAD" reflogs.

Even though the ref was at one point on every team member's computer,
and they still undoubtedly have a dangling commit in their repos,
they're going to have a hard time finding it - there are many dangling
commits in any given repo.

Now my question: is there any way to (temporarily) keep a reflog for
that deleted/pruned branch, in those team members' repos?

As far as I can tell, even "core.logAllRefUpdates=always" does *not*
keep any reflog entries around, even temporarily (until reflog
expiry), once a ref  is deleted - do I understand that correctly? Is
this behavior intentional / reasoned, or just a consequence of the
fact that it's *hard* to keep "managing" per-branch reflogs for
branches that don't exist?

I am planning a workaround using server hooks to "back up" refs that
are being deleted from specific namespaces, in my specific case, and I
imagine that a system like github keeps track of deleted stuff itself
for a while, but I find this "per-ref reflog disappearance" behavior
puzzling / out-of-character, so wanted to make sure I'm not missing
something.

Thanks,
Tao

             reply	other threads:[~2022-03-08 11:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 11:27 Tao Klerks [this message]
2022-03-08 11:54 ` Keep reflogs for deleted (remote tracking) branches? Han-Wen Nienhuys
2022-03-08 12:59   ` Ævar Arnfjörð Bjarmason
2022-03-14  8:25     ` Tao Klerks
2022-03-14 10:44       ` Ævar Arnfjörð Bjarmason
2022-03-14 12:10         ` Tao Klerks
2022-03-08 14:57 ` Jeff Hostetler
2022-03-14  8:09   ` Tao Klerks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPMMpog=qBwLrxss_ci6ZMM+AjbdrF8tszXLW7YH1Zqr+m7mPQ@mail.gmail.com' \
    --to=tao@klerks.biz \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).