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 8431531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:52:48+00:00 2026-06-10T05:52:48+00:00

I made a mistake setting up a remote on my git repo and fetched

  • 0

I made a mistake setting up a remote on my git repo and fetched from a totally different project.

Fortunately, there was no merge, but I now have the history of 2 projects floating around in my repo and I’m trying to figure out how to get my repo back to the state it was in before I made the erroneous fetch.

I’ve been reading about reflog, rebase, gc and other commands trying to work out which will help me get rid of the stuff I accidentally fetched, but so far haven’t got any where.

It looks like I’ve got the history of both projects in my repo, but they’re totally independent. There are essentially 2 separate trees of commits running in parallel to each other, in fact, this is what I see in gitk when looking at all branches:

enter image description here

You can see that the commits in the middle are not connected to the commits at the beginning and end of the history. Date-wise, they’re interleaved, but gitk doesn’t show them interleaved for some reason.

The isolated commits (in the middle of the pic) are the ones I’m trying to rid myself of, and they don’t appear to be attached to any branch. There’s no route from any of the HEADs in my repo back to this set of commits.

So far I’ve tried (in order in case it makes a difference):

git remote prune
git prune
git gc
git gc --aggressive --prune=tomorrow
git remote update --prune
git fetch --all

But nothing has helped yet. Can anyone suggest how I can remove these commits from my repo?

  • 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-06-10T05:52:49+00:00Added an answer on June 10, 2026 at 5:52 am

    You just need to remove the dangling tag (0.1.something, where something isn’t visible in your screenshot) using git tag -d 0.1.something. Once this is done, the commits will be gc-able.

    As long as there is a tag that reaches a commit, this commit is considered reachable and will thus persist “forever”, it’s effectively immune to garbage-collection until you remove any refs that point to it (branches, tags, other refs, …)

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

Sidebar

Related Questions

Yes, in the console, I made the horrible mistake of setting a DOM breakpoint
I have made a foolish mistake. I installed .Net before setting my regional settings
Please help me finding where I have made mistake? delimiter // CREATE FUNCTION `count_photos_in_gallery`(`tmp_gallery_id`
I made a mistake in a bulk insert script, so now i have duplicate
I made the mistake of defining in my schema a column named desc which
I made the mistake of modifying my original source after importing it into subversion.
We made the mistake of allowing .csproj.user files to be checked in to TFS
I made a mistake when I created one of my UIViewController objects. When I
I made the mistake of downloading the latest Silverlight runtime so that I could
I made a mistake when I rebase to a recent commit. ( I forgot

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.