Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Git

Git: Fix a Filter-Repo Run Orphaning an Old Tag Pointer

- 28.11.26 - ErcanOPAK

🔀 Fix a Filter-Repo Run Orphaning an Old Tag Pointer

When git filter-repo rewrites history with a path filter, it only keeps commits that actually touched the kept paths – and an annotated tag pointing at a commit that gets filtered out entirely, because that commit only modified a path outside the filter, has nothing left for filter-repo to remap it onto. Unlike filter-branch, which historically left such a tag pointing at the old, unrewritten commit, filter-repo’s default behavior is to simply drop the tag from the rewritten repository’s refs – so after a run that reports success, a project’s release tags can be gone outright, not pointing at the wrong commit, just absent, because the commit they referenced was swept up by the very same filter that was only meant to clean up unrelated files.

🔎 The Problem

$ git filter-repo --path src/ --path README.md  # keep only these paths
...
New history written in 4.21 seconds...
Completely finished after 6.38 seconds.

$ git tag
v2.0.0
v2.1.0
# v1.5.0 is missing - it pointed at a commit that only modified
# docs/CHANGELOG.md, a path the filter didn't keep, so filter-repo
# had no rewritten commit to re-target the tag onto and silently
# dropped it from the rewritten history's refs entirely

✅ Fix: Audit Tags Before You Filter

  • Before running filter-repo with any path filter, list every existing tag and the commit each one points to, so you have a record of what should still exist afterward to check against.
  • If a tag’s target commit falls outside the kept paths, decide deliberately whether that tag should be remapped to the nearest kept ancestor, preserved as a ref pointing at the original commit in a separate backup clone, or genuinely allowed to disappear – rather than discovering the gap only when someone later asks where a release tag went.
  • Keep the original, unfiltered clone until every tag has been checked against the rewritten repository, since it’s the only place the original tag-to-commit mapping still exists once the filtered repo has been pushed.

🚨 Why This Is Dangerous

A release tag that’s simply gone, with no error and no warning in the filter-repo output, can go unnoticed for months until someone tries to check out that exact release and finds it doesn’t exist anymore – by then, the only copy of the original mapping may be an old clone someone happens to still have lying around.

filter-repo rewrites what it can reach from the paths you kept – a tag pointing anywhere else isn’t moved, it’s just left with nothing to point at.

— Version Control Tip

Related posts:

Git: Fix a Merge Reporting Already Up to Date Even Though the Remote Has New Commits Because You For...

Git: Fix a Merge Reporting Already Up to Date Even Though the Remote Has New Commits Because You For...

Git: Fix git fetch --all Not Actually Updating a Remote Branch Because a Second Remote With the Same...

Git: Fix git fetch --all Not Actually Updating a Remote Branch Because a Second Remote With the Same...

Git: Use Git Bundle to Transfer Repos Without a Server

Git: Use Git Bundle to Transfer Repos Without a Server

Views: 6
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

C#: Fix a Required Member Satisfied by the Wrong Initializer
Asp.Net Core: Fix Response Caching Ignoring a Vary Header

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 562 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com