I created a repository, however I accidentally committed files that I do not want to commit at all. I'd like to cancel that first commit. git reset HEAD~
doesn't work for me, I get an error:
$ git reset --soft HEAD^
fatal: ambiguous argument 'HEAD^': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
I tried to do "reverse commit" in Attlasian SourceTree. That just removed all files, but I don't want to delete them, so I reverted it again. I now have even more commits which I want to remove.
I'd like to cancel all commits in this repository, then add .gitignore
first, then add other files. The commits are local only, I did not push anything. Some of the files in the first commits must not be ever pushed online, since they contain classified data.