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

  • Home
  • SEARCH
  • 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 1100341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:51:56+00:00 2026-05-17T00:51:56+00:00

If I have a commit in the past that points to one parent, but

  • 0

If I have a commit in the past that points to one parent, but I want to change the parent that it points to, how would I go about doing that?

  • 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-17T00:51:57+00:00Added an answer on May 17, 2026 at 12:51 am

    Using git rebase. It’s the generic “take commit(s) and plop it/them on a different parent (base)” command in Git.

    Some things to know, however:

    1. Since commit SHAs involve their parents, when you change the parent of a given commit, its SHA will change – as will the SHAs of all commits which come after it (more recent than it) in the line of development.

    2. If you’re working with other people, and you’ve already pushed the commit in question public to where they’ve pulled it, modifying the commit is probably a Bad Idea™. This is due to #1, and thus the resulting confusion the other users’ repositories will encounter when trying to figure out what happened due to your SHAs no longer matching theirs for the “same” commits. (See the “RECOVERING FROM UPSTREAM REBASE” section of the linked man page for details.)

    That said, if you’re currently on a branch with some commits that you want to move to a new parent, it’d look something like this:

    git rebase --onto <new-parent> <old-parent>
    

    That will move everything after <old-parent> in the current branch to sit on top of <new-parent> instead.

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

Sidebar

Related Questions

I'd like to have a commit message cleanup that will not necessarily remove lines
In git, i have 2 commit and a branch merge that have been rebased
I have a post-commit hook in svn that runs fine from the command line
I have a ton of new files to commit. Clicking each one in git
I just read amending a single file in a past commit in git but
I have created an SVN repository for project but now realise that the files
In a git repository I have a subdirectory that I want to reset to
I have an int/string(s) that is passed from one fragment to another. For each
I have a commit, I have stored in a branch, because this should go
I need to merge between dev and master frequently. I also have a commit

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.