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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:35:23+00:00 2026-05-24T22:35:23+00:00

I accidentally committed the huge unwanted folder and pushed it to master in git.

  • 0

I accidentally committed the huge unwanted folder and pushed it to master in git. And i had one more commit after that. so its like this

A – B – C – D

C – is the problematic commit

After realizing the mistake i used the command

git reset --hard <sha1-commit-id-of-B>

and

git push origin HEAD --force

to rollback to the B. It was fine, but the size of the repo is still same. i was confused. how can i get rid of the unwanted files(permanently), so it wont appear on the git?

  • 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-24T22:35:24+00:00Added an answer on May 24, 2026 at 10:35 pm

    Even if you move the branch pointer back in this way, git doesn’t immediately garbage-collect the objects that are now no longer referenced. This is a good thing – it means, for example, that if you mistakenly do a git reset --hard, then you can recover the old commits easily, typically by using the reflog to find the object names of those commits, and creating a branch from one of them. If you really want to garbage collect immediately to reclaim the space, you can do:

    git gc --prune=now
    

    However, one almost never needs to do this…

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

Sidebar

Related Questions

I accidentally added a folder of images and committed. Then, I made one more
I accidentally committed to the wrong branch. How do I delete that commit?
I accidentally committed the wrong files to Git , but didn't push the commit
Today I came across a problem where someone had accidentally committed a proj.user file
I accidentally pushed a commit to GitHub. Is it possible to remove this commit?
I accidentally committed some changes to the repository that were not complete. I do
I pulled a stupid and accidentally committed a folder named ${env.CATALINA_HOME} to my subversion
Okay, so I accidentally put the wrong remote URL into one of my git
I had a lot of local changes. I just accidentally did git merge another_branch
I am currently using TortoiseHg (Mercurial) and accidentally committed an incorrect commit message. How

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.