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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:27:16+00:00 2026-05-10T13:27:16+00:00

Suppose your git history looks like this: 1 2 3 4 5 1–5 are

  • 0

Suppose your git history looks like this:

1 2 3 4 5

1–5 are separate revisions. You need to remove 3 while still keeping 1, 2, 4 and 5. How can this be done?

Is there an efficient method when there are hundreds of revisions after the one to be deleted?

  • 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. 2026-05-10T13:27:16+00:00Added an answer on May 10, 2026 at 1:27 pm

    To combine revision 3 and 4 into a single revision, you can use git rebase. If you want to remove the changes in revision 3, you need to use the edit command in the interactive rebase mode. If you want to combine the changes into a single revision, use squash.

    I have successfully used this squash technique, but have never needed to remove a revision before. The git-rebase documentation under ‘Splitting commits’ should hopefully give you enough of an idea to figure it out. (Or someone else might know).

    From the git documentation:

    Start it with the oldest commit you want to retain as-is:

    git rebase -i <after-this-commit>

    An editor will be fired up with all the commits in your current branch (ignoring merge commits), which come after the given commit. You can reorder the commits in this list to your heart’s content, and you can remove them. The list looks more or less like this:

    pick deadbee The oneline of this commit pick fa1afe1 The oneline of the next commit ...

    The oneline descriptions are purely for your pleasure; git-rebase will not look at them but at the commit names (‘deadbee’ and ‘fa1afe1’ in this example), so do not delete or edit the names.

    By replacing the command ‘pick’ with the command ‘edit’, you can tell git-rebase to stop after applying that commit, so that you can edit the files and/or the commit message, amend the commit, and continue rebasing.

    If you want to fold two or more commits into one, replace the command ‘pick’ with ‘squash’ for the second and subsequent commit. If the commits had different authors, it will attribute the squashed commit to the author of the first commit.

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

Sidebar

Ask A Question

Stats

  • Questions 77k
  • Answers 77k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Looking around quickly I found two scripts that hold promise:… May 11, 2026 at 3:28 pm
  • added an answer for C++ I've used boost::asio, it's very modern C++, and… May 11, 2026 at 3:28 pm
  • added an answer The view structure is based on the controllers, not the… May 11, 2026 at 3:28 pm

Related Questions

Assumption: live/production web app suppresses errors being shown to end-users. Suppose your tech support
I think there must be something subtle going on here that I don't know
When presented with a simple table view (or even a list view I suppose)
Suppose you want a box on your website that says Give us your email

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.