put THEIR commits AFTER my commits with a single rebase command
- From
- Ilya Basin <basinilya@gmail.com>
- Date
- Apr 18, 2013, 05:18 UTC
- Message-ID
- <1928280357.20130418091807@gmail.com>
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 *masterdesired result:
A---B---C origin/master
/
D---E---F---G---A'---B'---C' *masterVariant 1:
git branch -f tmp
git reset --hard origin/master
git rebase tmpThis 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 masterToo 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.