I have a git repo that contains the following (simplified):
-- .git/
-- data/
|_ bar.txt
-- src/
|_ foo.py
-- .gitignore
The .gitignore
ignores only the data directory. So, in this case, src/foo.py
and .gitignore
were staged and commited.
I want to remove the .git
repo AND all files/folders tracked by git without deleting the entire directory as I want to keep the untracked files (ie remove src/foo.py
, .gitignore
, and .git
but keep the data
folder and it's contents).
I looked at git clean
and tried searching stack overflow, but I couldn't seem to find an answer.
Note: The above repo is just used as an example, the actual repo I'm concerned with is much more complex and populated.