Reputation: 13310
I forked out a repo and worked for a while with some 10 commits (10c), then I merged from upstream (m1) and then worked for a while and had 3 commits (3c).
Iam trying to rebase now, while 3c is ok, when I go beyond m1 to rebase/squash messages, It is asking me to merge again - why?
Upvotes: 1
Views: 20
Reputation: 1325047
Instead of having merged 10c:
X--x--x--M (10c) --x--x--x (3c, master)
/ /
u--u--u--u--u (upstream/master)
It would have been best to rebase 10c on top of upstream/master.
Considering the current situation, where you have 10 commits (from X to M, excluding the merge commit), then 3 commits, you could do:
# let's mark the current master
git checkout master
git branch tmp
# let's reset master to just before the merge commit
# make sure you don't have any work in progress
git stash
git reset --hard M^1
X--x--x (master) --M (10c) --x--x--x (3c, tmp)
/ /
u--u--u--u------------u (upstream/master)
# let's rebase those 10 commits (from X) on top of upstream master
git rebase upstream/master
X--x--x--M (10c) --x--x--x (3c, tmp)
/ /
u--u--u--u--u (upstream/master) --X'--x'--x' (master)
# Finally, rebase tmp
git checkout tmp
git rebase --onto master M tmp
git merge master
X--x--x--M (10c) --x--x--x (3c)
/ /
u--u--u--u--u (upstream/master) --X'--x'--x'--x'--x'--x' (tmp,master)
Upvotes: 2