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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:43:15+00:00 2026-05-29T20:43:15+00:00

Starting from branch master, to merge a topic branch one just says git merge

  • 0

Starting from branch master, to merge a topic branch one just says

git merge topic

If one wants to rebase, however, the commands are

git rebase master topic
git checkout master
git merge topic

The last two lines just fast-forward the master branch to the topic branch, so variation is possible, e.g. I like the following pattern:

git rebase master topic
git rebase topic master

It gets even more complex when the state of the local “topic” branch shall be preserved:

git checkout -b tmp topic
git rebase master
git rebase tmp master
git branch -d tmp

Is there a simple command for that? Something that works as simple as git-merge on the CLI but actually performs a rebase, without moving the topic branch?

  • 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-29T20:43:16+00:00Added an answer on May 29, 2026 at 8:43 pm

    There’s no perfect command that does this in one go, but there’s a pretty close second.

    Assuming that topic will cleanly fit atop master without conflict, this will work from the master branch:

    git cherry-pick master..topic
    

    master..topic is the set of changes in topic but not master, and cherry-picking them in order is effectively a rebase if topic is cleanly on master.

    For the two-command perfect-fidelity case (or three to preserve topic), I wouldn’t do two rebases like you have there, I would do a rebase and an update-ref for clarity.

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

Sidebar

Related Questions

Coming from svn, just starting to become familiar with git. When a branch is
I am just starting out with GIT (i'm coming from cvs) and would like
I'm just starting out with bazaar, and I've found that the checkout feature is
After making a few changes to branch master I decided to work from a
In Git, what does deletion of a branch mean? Will it be gone from
I'm starting tests to move from cvs to git, and I have a problem
I am just starting to use Subversion with Tortoise SVN client for one of
I'm starting to learn Git, reading the ProGit book from time to time. I've
Starting from this code: class Base{ public: virtual void foo(){....} }; class Derived{ public:
Starting from ASP.NET MVC Preview 3, HTML.Button ( and other related HTML controls) are

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.