After quite a few hours playing with rebase, the repo still looks different from what I need:
I would like to accomplish the following tasks:
[some of which were
First, re-ordering the backup commits.
# Safety, should be a no-op if your gitk snapshot is accurate
git checkout backup
# Temporary branch
git branch backup-save backup
# Move top commit onto 'Fix for #226:
git rebase --onto origin/master HEAD^
# Go back to saved branch's parent (i.e. without the moved commit)
git reset --hard backup-save^
# Rebase onto the moved commit (HEAD@{1} is where HEAD was 1 step
# ago i.e. before the reset.)
git rebase HEAD@{1}
# Don't need the saved branch any more (although you might want
# to keep it for a bit just in case). This deletes it:
git branch -D backup-save
Combine the two commits on twist, ignoring the top commit message.
git checkout twist
git reset --soft HEAD^
# Just re-save the commit message, alternatively to skip the
# editor step do this: git commit --amend -C HEAD
git commit --amend
Merge the twist branch into backup, remove the twist branch.
git checkout backup
git merge twist
git branch -d twist
Move master. There are multiple fancy ways, but this is simplest. I'm assuming that you want master to point to the edited backup position and not where it originally was.
git checkout master
git reset --hard backup
remote/origins/master is the remote tracking branch and tells you where the branch pointer for the master branch in the remote repository origin is, or rather was when you last fetched, pushed or pulled.