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.
Essentially I want to push everything I have, but want to get rid of a whole lot of history.
Perhaps I would be better running in a branch for all my dev, then just merging back to master before committing… then the history for master will just be the commit I want.
I’ve tried running rebase:
git rebase –i HEAD~3
That went back 3 commits, and then I could delete a commit.
However ran into auto cherry-pick failed, and it got quite complex.
Any thoughts greatly appreciated… no big deal to can the history and start again if this gets too hard 🙂
You can branch your current work, rewind the master, then cherry-pick the latest commit back to the master:
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)