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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:24:52+00:00 2026-06-17T20:24:52+00:00

In our git repo we accidentally made a commit that deleted all of our

  • 0

In our git repo we accidentally made a commit that deleted all of our files. This commit was pushed to our central server and has been pulled down by other developers and build servers so rewriting the history to undo this is not ideal. Instead we made another rollback commit to restore all of files to their previous state with another attempted rollback commit in between that somehow only restored some files.

cc043989 Rollback commit (goes back to 4bf31def)
f5d7f10e Failed rollback commit
cd60376f Delete all files commit
4bf31def Last good commit
.
.
.

Our concern is whether this will result in any long term impact, specifically with regards to merges to/from feature branches and to/from subtree repos. If it’s going to constantly make merges or something else much more challenging in the future it may be worth just rewriting the history and dealing with the build server/other developer repos manually.

  • 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-17T20:24:53+00:00Added an answer on June 17, 2026 at 8:24 pm

    Suppose your history looks like this:

    A --- B --- C --- D   master
     \
      E --- F             topic
    

    In commit “B”, you accidentally delete all files. In commit “C”, you restore all files.

    When you merge the topic branch into the master branch, you will get many more merge conflicts than you would get otherwise. I suggest rewriting history as if the files were never deleted, since there is no real benefit to keeping that commit around (unless it’s a very public branch).

    To delete the commits,

    git checkout master
    git rebase -i 4bf31def
    

    Then comment out the bad commits:

    # cc043989 Rollback commit (goes back to 4bf31def)
    # f5d7f10e Failed rollback commit
    # cd60376f Delete all files commit
    4bf31def Last good commit
    

    The good news is that you can take your time. You can keep working and fix history later, or you can fix it now.

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

Sidebar

Related Questions

I pushed some changes to our central git repository, and then immediately realized that
So, a config file somehow made its way into our git repo that we
Our central git repository got in a weird state after a commit that involved
This morning we pulled from our repo, and git put us on (no branch).
I am using git-svn for our svn repository. However, the repo is huge, so
Our git development workflow is that topic branches are continuously rebased on the latest
We are looking to use GIT to help manage our web files as we
I'm trying to import our SVN repository into Git. When I run either this
I'm about to do a git svn dcommit to our svn repo -- and
I have a Debian server and a git repo (Assembla). What I would like

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.