I hardcorded some credentials in the first commit of a repo, here is git log
output:
commit 7958f03d51b0c3852bffc43bd169a121314dafca (HEAD -> master)
Author: Alexander Mills <alex@alexs-mac.local>
Date: Tue May 7 13:14:45 2019 -0700
modify dockerfile
commit d16acc2b2331e5afdc51d87d05b3aeb01397d4ef (origin/master)
Author: Alexander Mills <alex@alexs-mac.local>
Date: Thu May 2 11:48:14 2019 -0700
init
how can I remove the first commit ("init")?
I tried:
git reset --soft HEAD~1
but that will only allow me to reset to the first commit. If I try git rebase -i HEAD~1
, I get:
pick 7958f03 modify dockerfile
# Rebase d16acc2..7958f03 onto d16acc2 (1 command)
# ...
So there is no obvious way to remove that first commit with I either git reset
or git rebase
...is there a way to git rid of the first commit somehow?
Note: I could blast the .git repo folder, but as an exercise, some people might have many more commits than 2 and want to remove the first, or first 5, commits from a repo to get rid of hardcoded creds etc.