Reputation: 11
A recent issue has arised.
I have my local copy of code at ~/code/
directory where I made a git init
. Whenever I copied a folder with files within it, git recognized folders and files normally.
This is the output of ls -l of ~/code/:
drwxrwxr-x 2 david david 4096 oct 30 15:20 hw0
drwxrwxr-x 4 david david 4096 oct 30 15:20 hw1
drwxrwxr-x 4 david david 4096 oct 30 15:20 hw1.5
-rw-rw-r-- 1 david david 82 oct 30 15:20 README.md
But today I copied a folder and when I did a git status
, git recognized hw2/
folder as a file. Additionally, I removed .git
folder and reinitialized git and now every folder is recognized as file.
Now the output is this for git status:
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# README.md
# hw0/
# hw1.5/
# hw1/
nothing added to commit but untracked files present (use "git add" to track)
All of those four items in color red. hw2/ is not in the list because I moved it to another directory because the code in it I fear it to be lost.
Any ideas why this could be?
Upvotes: 0
Views: 927
Reputation: 993095
What you have described seems perfectly normal. Yes, Git lists your directories in the "Untracked files" section, but it indicates directories with a trailing /
. What that means is Git is not tracking any of the files within that directory.
To remove directories such as hw0/
from your list of untracked files, add one or more files within that directory to Git using git add
.
Upvotes: 2