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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:36:57+00:00 2026-06-04T16:36:57+00:00

I have a project containing two branches: master and gh-pages. They are essentially two

  • 0

I have a project containing two branches: master and gh-pages. They are essentially two different projects, where the gh-pages project depends on the master project (and not vice versa). Think of it as “master contains the source code, gh-pages contains the binary built from those source files”. Periodically, I take the changes that have accumulated in master and make a new commit to the gh-pages branch with the commit message “Bring into line with master commit xxxxxxxx.”

how the network graph currently looks

After a while of doing this, I realized that it would be nice if the gh-pages commit “Bring into line with master commit xxxxxxxx” actually had xxxxxxxx as its parent in the git repository. Like this (bad MSPaint art):

how it would ideally look

Is there a way to make the repository look like the second image above? I know how to make new commits follow this pattern: I can do “git merge -s ours master” (which sets the parents of an otherwise empty commit) followed by “git commit –amend adv550.z8” (where adv550.z8 is the binary file that’s actually changing). But does git make it easy to go back in time and add new parents to old commits?

I am perfectly willing to “git push -f” and blow away the current history of my Github repository, once I get my local repo looking right. The question is, can I get my local repo looking right?


EDITED YEARS LATER TO ADD: I eventually abandoned my attempts to make the git history of gh-pages look like that; I decided that it was too much work for zero gain. My new practice is to aggressively squash commits to gh-pages, because saving those commit messages really doesn’t matter in my case. (It’s just a long line of “Bring into line with master commit…”s, none of which are historically interesting.) However, if I needed to do this again, I’d listen to the answers that said

git merge $intended_parent_1 $intended_parent_2
git checkout $original_commit -- .
git commit --amend -a -C $original_commit
  • 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-04T16:36:59+00:00Added an answer on June 4, 2026 at 4:36 pm

    You can’t go back in time and change existing commits. Even when you do something like git commit --amend, you’re not actually changing the commit; you’re creating a new one at the same place in the tree with all the content from the original (plus your changes). You’ll notice that the commit hash changes after the --amend, and the original is still present in your repo–you can get back to it with git reflog.

    On the other hand, you can go back in time and create an alternate universe. Essentially, you would go back to your gh-pages branch point and recreate the whole thing (with e.g. git cherry-pick or something) as a parallel branch. The hashes would change, because the commits are different objects.

    (I’m curious why you have your repo set up as separate branches, instead of separate directories in the same branch. It seems like the code -> build process would get tedious.)

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

Sidebar

Related Questions

I have two Android projects, a 'library project' containing a custom layout, and an
I have a .NET solution containing two projects: An ASP.NET MVC project, 'Website' A
I have a project group containing two projects that share one source folder,but do
I have three projects 1)unmanaged c++ containing full business logic 2)C++/CLI ( Project name
I have a VS2008 solution containing two projects, a web service (the actual work
I have a solution containing a lot of projects and installer projects. One project
I have an eclipse project containing a source file. Now I have a different
I have a solution consisting of two projects: Project1 containing a single file program.cpp
I have a pretty simple console project with an entity model (containing two simple
I have a workspace in Eclipse containing two BlackBerry projects. I started the workspace

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.