git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Basin <basinilya@gmail.com>
To: git@vger.kernel.org
Subject: put THEIR commits AFTER my commits with a single rebase command
Date: Thu, 18 Apr 2013 09:18:07 +0400	[thread overview]
Message-ID: <1928280357.20130418091807@gmail.com> (raw)

I asked this on stackoverflow, but no reply.
http://stackoverflow.com/questions/15971244/git-put-their-commits-after-my-commits-with-a-single-rebase-command

Suppose master and origin/master diverged.
I'm on master and I want to put the commits from origin/master after my commits and then push --force.  

         A---B---C origin/master
        /
    D---E---F---G *master

desired result:

         A---B---C origin/master
        /
    D---E---F---G---A'---B'---C' *master



Variant 1:

    git branch -f tmp
    git reset --hard origin/master
    git rebase tmp

This variant is bad, because 'git reset --hard' checks out some files and 'git rebase' rewrites them again before applying commits. It's a redundant job.  
Variant 2:

    git branch -f tmp origin/master
    git rebase --onto master master tmp
    git branch -f master
    git checkout master

Too many commands. I want to do this with just one command. And I want
to stay be on branch master in case of rebase conflicts.

             reply	other threads:[~2013-04-18  5:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18  5:18 Ilya Basin [this message]
2013-04-18  6:21 ` put THEIR commits AFTER my commits with a single rebase command Johan Herland
2013-04-18  6:59   ` Re[2]: " Ilya Basin
2013-04-18  6:31 ` Johannes Sixt
2013-04-18  8:33   ` Re[2]: " Ilya Basin
2013-04-18 11:03     ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1928280357.20130418091807@gmail.com \
    --to=basinilya@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).