I’ve got a problem with my local git repo. There are many commits with sensitive info like connection strings. I don’t want to upload this history to GitHub.
Is there a way to push everything I have now but get rid of the old commits? I thought about using branches for development and only merging to master before pushing. That way master would only have the commit I want.
I tried using git rebase -i HEAD~3
to go back 3 commits and remove one. But I ran into issues with auto cherry-pick failing. It got pretty complicated.
Should I just delete the history and start over? Or is there an easier way to do this? Any advice would be great!
# Example of what I want to avoid
git log
commit abc123 (HEAD -> master)
Latest changes
commit def456
Added sensitive data
commit ghi789
Initial commit
# What I want to push
git log
commit abc123 (HEAD -> master)
Latest changes
Thanks for any help!