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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:45:02+00:00 2026-05-22T12:45:02+00:00

On git-filter-branch , it is said: To set a commit (which typically is at

  • 0

On git-filter-branch, it is said:

To set a commit (which typically is at the tip of another history) to be the parent of the current initial commit, in order to paste the other history behind the current history:

git filter-branch --parent-filter 'sed "s/^\$/-p <graft-id>/"' HEAD

(if the parent string is empty – which happens when we are dealing with the initial commit – add graftcommit as a parent).

This is exactly what I want to, i.e. to set the parent (to commit A) of some root commit (B). See here for a related question.

But what exactly is the graft-id in that command? Is that the new parent, i.e. A?

Further on, an even simpler example is given to achieve the same:

or even simpler:

echo "$commit-id $graft-id" >> .git/info/grafts
git filter-branch $graft-id..HEAD

Again, what is $graft-id supposed to be in this example? And $commit-id = A, right? Or is it $commit-id = B and $graft-id = A?

I also read this but I still don’t really understand why I need such a concept here. Why can’t I just do git filter-branch A..HEAD or so?


Ok, I think I figured it all out, see my own answer.

To explain why I needed it:

In our project OpenLieroX, we had Google Breakpad included at one point.

We didn’t took it from the official SVN (because it didn’t worked at that time for me) but from the latest LastFM stable instead (it was just random that is was from there — I had it also on my disk and knew that the LastFM people probably took some stable Breakpad version).

Then, when time went on, we applied several patches to our own copy of Google Breakpad.

Now, many months later, we want to clean the histories a bit up, get a good overview of all our patches to Breakpad and maybe also get them upstream. And most importantly (for us), we want to update our copy of Breakpad.

So, I thought that the best thing would be to create a new Git repository, fetch the official source history from somewhere into it and get all the Breakpad specific stuff from our main repository via git filter-branch into it. I used this Breakpad mirror as a base. The filter-branch was also a bit more complicated because we moved the whole Breakpad directory at one point inside the OpenLieroX repository.

So I ended up with three branches:

  • breakpad-in-mainsrc: git filter-branch-first-run for the time when Breakpad was in src/breakpad/external.
  • breakpad-in-libs: git filter-branch-second-run for the time when Breakpad was in libs/breakpad.
  • official: Copy of master from the Breakpad mirror.

Then I searched for the commit in official which was most close to the root in breakpad-in-mainsrc. I didn’t got any perfect match, so I used the most close one (wrote a small Python script to figure that out). This one is tagged now as olx-closest-initial-breakpad.

And then I wanted to merge these three histories all together. This went fine the way described above (and given my own answer below).

The result is here: OpenLieroX Google Breakpad on GitHub

  • 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-22T12:45:02+00:00Added an answer on May 22, 2026 at 12:45 pm

    This is a rather obscure feature.

    If you should need this, you better make doubly sure you know exactly how git works behind the scenes and you know what it is you wanted to achieve.

    Also, there is a newer, probably more useful (at least it is more flexible) feature called git replace (man page)

    IMHO that same documentation contains ample info should you really need this.

    But see

    1. https://git.wiki.kernel.org/index.php/GraftPoint
    2. What are .git/info/grafts for?
    3. http://bugsquash.blogspot.com/2010/03/stitching-git-histories.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I remove commits which have no changeset using git filter-branch? I rewrote
Git has a bunch of procedures for altering history. ( rebase , filter-branch ,
I'm using git filter-branch --subdirectory-filter dir/name -- --all to build a repo that only
I'm trying to figure out how to work git filter-branch and I need help
I currently have git and virtualenv set up in a way which exactly suits
Some Git commands take commit ranges and one valid syntax is to separate two
Suppose your git history looks like this: 1 2 3 4 5 1–5 are
Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks
I used filter-branch to fix an incorrect email address in my repository but all
I have a branch that I'd like to move into a separate Git repository,

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.