So Im new to Git, hence a lot of my terminology might be off here
Is the right thing here to do a 'rebase'? - im not quite sure, but it sounds right. Essentially I want to get my changes from myfork into the TestHarness fork and both of these are forks of Mainline
And then I would like to go back 2 revisions onto my fork, so Im back where I began before adding the test harness code
Can someone point out what the git magic is required to do this?
If I understand the question correctly you have 4 repositories:
You have commits on "MyFork" that you want to "move over" to "TestHarness".
First of all, you may want to rethink the way you are handling forks. Are your TestHarness changes that large that it requires a new repository?
If you are sure that you want to continue with your path, I think I would do as follows:
I would first go to your "TestHarness" repository and add your "MyFork" as a remote repository and fetch its data:
git remote add myfork myfork_url git fetch myfork
Then I would cherry pick your two commits from your "MyFork" repository:
git cherry-pick commit_1_hash git cherry-pick commit_2_hash
Now you should have your two commits on your "TestHarness" fork.
Go back to your "MyFork" and then move back two steps as follows:
git reset --hard HEAD~2
Note that this will delete your changes permanently on your "MyFork" fork. You can remove the
--hard if you want to keep them.
At any time if you want to see the current state of your repository try
git log --graph --decorate --all