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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:20:38+00:00 2026-05-11T17:20:38+00:00

I have a master branch in my project, that I use to pull changes

  • 0

I have a master branch in my project, that I use to pull changes from other people. From that, I usually have several topic branches on which I’m currently working.

My question is: Is there a way for me to pull new changes into my master and then rebase ALL of my topic branches onto that at once?

This is the situation:

        D--E topic1
       /
A--B--C master
       \
        F--G topic2

And I want to accomplish this with one single command (H came from upstream) :

               D'--E' topic1
              /
    A--B--C--H master
              \
               F'--G' topic2

Now, I know I can accomplish this by rebasing topic1 and topic2 onto master, and I could even write a script to automate this. But what if I have several other branches, create new ones and delete others frequently and I receive upstream changes all the time?

This operation (several rebases), when done by hand, is both tiring and error-prone.

Is there an easier way?

  • 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-11T17:20:38+00:00Added an answer on May 11, 2026 at 5:20 pm

    I’m fairly sure that there isn’t a way to automatically do this. Remember that “git rebase master” can also drop you back to the shell needing you to resolve merge conflicts, so if you want to write a script to automate all this you need to take that into account.

    You can fairly easily track which branches need updating, though. Hmm, for any branch, “git rev-list branch..master” will produce output if the branch is not up-to-date wrt (i.e. just commits on top of) master. So you need to loop through all the local heads except master to produce a report (nb “git show-branch” will approximately do this):

    git for-each-ref 'refs/heads/*' | \
      while read rev type ref; do
        branch=$(expr "$ref" : 'refs/heads/\(.*\)' )
        revs=$(git rev-list $rev..master)
        if [ -n "$revs" ]; then
          echo $branch needs update
          git diff --summary --shortstat -M -C -C $rev master
        fi
      done
    

    So if you were feeling brave, you could replace that “git diff” with something like “git checkout $branch && git rebase master” (or maybe just “git pull –rebase” if you’ve set that up). I think you’d then have to check for the existence of a “.git/rebase-apply” directory or check the index for unmerged files (“git ls-files -u”) to test if we’ve been left waiting to do a merge.

    Of course, if there are no conflicts, then it’s easy… it’s producing something that also works when it’s not easy that’s the problem :p

    And this doesn’t necessarily address what happens if one of your branches is based on something else… that’s why I mentioned using “git pull –rebase” instead, because that would rebase according to the branch configuration, not blindly from master. Although the detection isn’t based on the branch configuration… maybe it would be easiest just to check out each branch and do “git pull” and let the branch configuration handle everything, including whether to rebase or merge?

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

Sidebar

Ask A Question

Stats

  • Questions 121k
  • Answers 121k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Also on the page you linked to in your answer… May 12, 2026 at 12:22 am
  • Editorial Team
    Editorial Team added an answer To answer my own question... It's possible. You can define… May 12, 2026 at 12:22 am
  • Editorial Team
    Editorial Team added an answer Regarding FindBugFilter, (just to be sure) are you sure you… May 12, 2026 at 12:22 am

Related Questions

I'm a Git newbie. I recently moved a Rails project from Subversion to Git.
I often need to develop stuff on the road, with no internet/network connection. I
What would possibly cause a 'git push' to try and commit to two branches?
Last week, I made a number of changes to my local branch before leaving

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.