On my local git repo I\'ve got many commits, which include \'secret\' connection strings :-)
I don\'t want this history on github when I push it there.
Essen
You can branch your current work, rewind the master, then cherry-pick the latest commit back to the master:
git branch secret
git reset --hard HEAD~3
git cherry-pick secret
In pictures,
A--B--C--D--E (master)
after git branch secret
:
A--B--C--D--E (master, secret)
after git reset --hard HEAD~3
:
A--B (master) \ C--D--E (secret)
after git cherry-pick secret
:
A--B--E' (master) \ C--D--E (secret)
Finally, if you git checkout secret; git rebase master
, you can get:
A--B--E' (master) \ C--D (secret)