git reset --soft HEAD~1 only resets HEAD to the previous commit until the index and working directory are affected.
This means that the index and working directory still reflects the state containing confidential information. Just remove these files from the git reset HEAD <file>... index and commit again.
After deleting confidential data files from the index, they will remain in the working directory. You might also want to remove them from the working directory or add them to .gitignore .
EDIT
Do you mean that I have to do git reset --soft HEAD ~ 1 first and then git reset HEAD?
Yes. Usually you create git add .. files and then commit them. If you do git reset --soft HEAD~1 , your repository reflects the state before this commit. You can see this if you run git status . This way you can change the index and commit again.
Also, does data delete 100% from git history?
No, not completely. If the commit is no longer specified, git will delete it after 90 days (the default is see git gc ). If you want to remove it immediately, you must make sure that it is no longer referenced. Therefore, you should remove it from any reflog containing it, for example. git reflog --delete HEAD@ {3} . Usually it will be contained in the HEAD block and your branch. Also make sure that it is not contained in any branch, for example. if commit, if A do a git branch -a --contains A The output must be empty.
You can then collect the garbage using git gc --prune=now . Verify that the commit has been removed using git log -n1 COMMIT-ID . It should output fatal: bad object .
For more information on deleting files and directories from git, see my blog https://www.link-intersystems.com/blog/2014/07/17/remove-directories-and-files-permanently-from-git/ .
source share