Reputation: 3
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)?
Upvotes: 0
Views: 189
Reputation: 481
git init
probably did nothing.
I would run a git status
to see all of the files you added with your git add -A
command and "unadd" the files you no longer want there by running git reset [filename]
Upvotes: 0
Reputation: 4476
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
Upvotes: 2