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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:19:08+00:00 2026-05-15T16:19:08+00:00

I would like to split out modules distributed with a bigger application into separate

  • 0

I would like to split out modules distributed with a bigger application into separate submodules and keep the ability to pull from upstream.

So this is more complex than Detach subdirectory into separate Git repository. I do not only have do use git-filter-branch once but want to keep the ability to pull upstream changes after I have done so (and upstream has not).

Simply rerunning git-filter-branch on the complete history from upstream now including new commits not found in my rewritten history is not an option as there are hundreds of modules for which I have to do this and the number of commits is getting close to 100.000.

I am guessing this involves limiting the history to just the new commits, rewriting those and then adding them after the previously rewritten commits, but I am unsure how to do this – and maybe there is a better approach.

It would be nice if branches and tags could be preserved too but this is not absolutely necessary and if it complicates things I would actually prefer to lose those.

  • 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-15T16:19:08+00:00Added an answer on May 15, 2026 at 4:19 pm

    For the first rebase do this:

    git checkout -b rebased master
    git filter-branch --some-filter
    git tag rebased-done master
    

    And to “merge” later commits:

    # Create a tempory branch and rebase it's tail use 'rebase-done~'
    # and not 'rebase-done' because some filters (like --index-filter)
    # require this, others might not.
    git checkout -b rebased-tail master
    git filter-branch -f --some-filter -- rebased-done~..HEAD
    
    # Get the commit in branch 'rebased' corresponding to tag 'rebase-done'
    # (which tags a commit in 'master' not 'rebased').  Depending on your
    # situation you might have to determine this commit differently (in my
    # use case I am absolutely sure that there is never a commit with the
    # same author date - if that doesn't work you might want to compare
    # commit messages).
    start_time=$(git show --quiet --pretty=%at rebased-done)
    start_hash=$(
    git log --reverse --pretty="%H %at" rebased_tail |
    while read hash time
    do
        [ "$time" = "$start_time" ] && echo $hash && break
    done
    )
    
    # Finally apply the rebased commits.
    git checkout rebased
    git format-patch -k --stdout $start_hash..rebased-tail | git am -k
    git branch -D rebased-tail
    git tag -f rebased-done master
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to remove the configuration out of my app.js and split it
I would like to split the following string generated from a database resultset row.
I would like to split some content from an a html tag. I was
I would like to split a line into words. I know this can be
I have a huge text file that I would like to split into multiple
I have a dataframe with one column that I would like to split into
We are currently writing an application which is split into multiple projects/modules. For example,
So my application is growing and I'd like to split out my View-based controllers
I would like to find out and keep track of the 'line number' (rows)
I have 1.2 million files split out into folders, like so: Everything ..........Folder 1

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.