I mistakenly ran 'git init' followed by 'git add -A' on a main folder (named "workspace"). I intended to 'cd' down into a new project folder (named "authentication") before running these commands.
The issue is, this main folder "workspace" already had numerous project subfolders that were individually in Git beforehand. The main folder was not previously under Git, nor ever meant to be. Fortunately, I have NOT ran 'git commit' on the main folder.
How do I safely reverse the 'git add -A' on the main folder, as well as revert the 'git init' command on the main folder, WITHOUT affecting all the subfolder projects that are to remain individually under version control (Git)?
If your main folder workspace
was not under Git before, just delete the folder workspace/.git
:
rm -r workspace/.git
If it was under Git, git init
will have pretty much no effect. The opposite action of add
is reset
:
git reset