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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:48:43+00:00 2026-05-22T20:48:43+00:00

Without creating a branch and doing a bunch of funky work on a new

  • 0

Without creating a branch and doing a bunch of funky work on a new branch, is it possible to break a single commit into a few different commits after it’s been committed to the local repository?

  • 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-22T20:48:44+00:00Added an answer on May 22, 2026 at 8:48 pm

    git rebase -i will do it.

    First, start with a clean working directory: git status should show no pending modifications, deletions, or additions.

    Now, you have to decide which commit(s) you want to split.

    A) Splitting the most recent commit

    To split apart your most recent commit, first:

    $ git reset HEAD~
    

    Now commit the pieces individually in the usual way, producing as many commits as you need.

    B) Splitting a commit farther back

    This requires rebasing, that is, rewriting history. To specify the correct commit, you have several choices:

    • If it is three commits back, then

        $ git rebase -i HEAD~3
      

      where 3 is how many commits back it is.

    • If it is farther back in the tree than you want to count, then

        $ git rebase -i 123abcd~
      

      where 123abcd is the SHA1 of the commit you want to split up.

    • If you are on a different branch (e.g., a feature branch) that you want to merge into master:

        $ git rebase -i master
      

    When you get the rebase edit screen, find the commit you want to break apart. At the beginning of that line, replace pick with edit (e for short). Save the buffer and exit. Rebase will now stop just after the commit you want to edit. Then:

    $ git reset HEAD~
    

    Commit the pieces individually in the usual way, producing as many commits as you need.

    Finally

    $ git rebase --continue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to place an email into multiple lotus notes folders without creating
How to do that without creating any new collections? Is there something better than
How can this be done more elegant and without creating new objects? List<Move> playerMoves
is it possible to access a static property of a COM object without creating
how to override ListView Items Property without creating new control ?
Is it possible to write to Netty channel without creating unnecessary ChannelFuture? (Without generating
I'm looking into creating a simple iPhone app without using the interface builder, i.e.
Is it possible to have something like ContactAddress.Contact in LINQ without creating a foreign
How can I create a modal dialog in winform without creating a new taskbar
How can i modify returning value of built-in php function without creating new function

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.