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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:51:46+00:00 2026-05-30T13:51:46+00:00

In my day-to-day git workflow, I have many topic branches, like so: o–o–o (t2)

  • 0

In my day-to-day git workflow, I have many topic branches, like so:

              o--o--o (t2)
             /
         o--o (t1)
        /
 o--o--o (master)
        \
         o--o--o (t3)

When I pull from upstream,

              o--o--o (t2)
             /
         o--o (t1)
        /
 o--o--o--n--n--n (master)
        \
         o--o--o (t3)

I want to rebase all my topic branches on top of the new master:

                        o'--o'--o' (t2)
                       /
                  o'--o' (t1)
                 /
 o--o--o--n--n--n (master)
                 \
                  o'--o'--o' (t3)

Currently I do this by hand, using git rebase --onto. In this scenario, the whole update process would be:

$ git checkout master
$ git pull
$ git rebase master t1
$ git rebase --onto t1 t2~3 t2
$ git rebase master t3

This gets even hairier when jumping between various topic branches and adding commits.

Dependencies between topic branches in my case are purely tree-like: no branch depends on more than a single other branch. (I have to eventually upstream dependent patches in some particular order, so I choose that order a priori.)

Are there any tools that can help me manage this workflow? I’ve seen TopGit, but it seems to be tied quite heavily to the tg patch email-based workflow, which isn’t relevant to me.

  • 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-30T13:51:47+00:00Added an answer on May 30, 2026 at 1:51 pm

    Pretty much the same question was asked on the git mailing list:
    Rebasing Multiple branches at once…
    The linked response has a perl script attached that generates the commands you would need.

    If you want this script to be fast and avoid having it tread on your toes, also consider using git-new-workdir to set up a working copy just for automatic rebasing.

    If you find yourself resolving the same conflicts over and over, consider enabling git rerere.

    Having said all that, here is an alternate recipe:

    # Construct a placeholder commit that has all topics as parent.
    HEADS="$(git for-each-ref refs/heads/\*)" &&
    MAGIC_COMMIT=$(echo "Magic Octopus"$'\n\n'"$HEADS" |
      git commit-tree \
        $(git merge-base $(echo "$HEADS" | sed 's/ .*//' ))^{tree} \
        $(echo "$HEADS" | sed 's/ .*//;s/^/-p /')) &&
    git update-ref refs/hidden/all $MAGIC_COMMIT
    
    # Rebase the whole lot at once.
    git rebase --preserve-merges master refs/hidden/all
    
    # Resolve conflicts and all that jazz.
    
    # Update topic refs from the rebased placeholder.
    PARENT=
    echo "$HEADS" |
    while read HASH TYPE REF
    do
      let ++PARENT
      git update-ref -m 'Mass rebase' "$REF" refs/hidden/all^$PARENT "$HASH"
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a local branch for day-to-day dev work in git. My workflow is:
I have been developing a branch happily and each day rebasing each day from
How can you merge two branches in git, retaining necessary files from a branch?
I have a git repository online and I use, as many do, to keep
When I open the git Shell window, I have to do each day the
I cloned a read-only Git repo from GitHub onto my server. The next day,
I have tried the last day to work with the Ruby gem git (version
I have to create several tags every day in a Git repository. When I
In an attempt to achieve git nirvana, I'm spending the day learning how to
I'm still learning the ropes of Git (love it!) but the other day I

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.