Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7648643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:46:12+00:00 2026-05-31T10:46:12+00:00

Git filter-tree helpfully stored a backup in .git/refs/original/refs/heads/tmp . But I can’t find any

  • 0

Git filter-tree helpfully stored a backup in .git/refs/original/refs/heads/tmp. But I can’t find any instructions on how to restore from it. I haven’t touched the repository since then – I just changed my mind about the wisdom of that particular manipulation.

I’m guessing the answer is either a file copy or git update-ref, but these are pretty destructive operations, and I don’t want to get it wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:46:13+00:00Added an answer on May 31, 2026 at 10:46 am

    Here’s the thing to know, from which all else flows: except when doing git gc (well, and things git gc does as well), git never removes anything, it only ever adds new things.

    Let’s say you have a branch that looks something like this:

    * 9d2e82c handle another temporary failure mode
    | * 2afb8a0 (resubmit) checkpoint: resubmit
    | * 90dcfbb move definitinon of GRONK to sysdefs
    |/  
    * 1ba7847 treat XML login errors as temporary failures
    

    (this is snipped and slightly modified output from git lola: http://blog.kfish.org/2010/04/git-lola.html). Now say I did something to my “resubmit” branch, like an incorrect filter-branch, so that I have two new commits on that branch (1234567 and 7654321, or whatever). I realize, oh no, I did something completely broken, and I want “resubmit” to go back to pointing to commit 2afb8a0, which is the original tip of that branch.

    That commit is still in git, and will be for several months at least (longer because you have the user-visible branch-name original/refs/heads/tmp—try doing git log on it for instance, you’ll see it’s there). Find the commit ID—easy in your case, it’s named original/refs/heads/tmp—and make your branch point there. If you didn’t have a name, you could do git branch -d resubmit and then git branch resubmit 2afb8a0 (for my own example above), but you do, so:

    git branch -D tmp
    git branch -m original/refs/heads/tmp tmp
    

    will delete your current tmp and rename the renamed one back to tmp.

    (The new commits filter-branch recently added, that you decided you don’t like after all, will still be in your repository. Once you’ve deleted the user-visible-names they’ll expire in about 3 months, after which git gc will remove them.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Git has a much-touted(?) octopus-merge capability that can merge many heads into one. But
I believe that git filter-branch can allow me to do this, but I can't
Is there any way to filter a git log to the commits specific to
How can I filter the git log to show only my changes (excluding the
Git works fine on my dev box, but ever so often, I'll go to
Git is implemented as a directed acyclic graph. Children know their parents but not
git-cherry lets me find all the commits missing from upstream. How do I find
Our git server will be local, but we want an server where our local
I used filter-branch to fix an incorrect email address in my repository but all
Here is the script that I want to run using git filter-branch : #!/bin/bash

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.