Files untracked in git not part of .gitignore

gcr

I did not include them in the .gitignore but they got untracked. Actually I added a pychache to the gitignore and was hoping that would also clean up the remote (it did). Then out of curiosity I wanted to see what was in the index and what fiels were being tracked so I ran some commands I saw on SO.

Specifically ones like: git ls-tree --full-tree --name-only -r HEAD

Then I did a git status and noticed a lot of my files that I was not ignoring (including the .gitignore ironically) were now considered untracked. I'm not sure what I did to make this happen.

Note that I'm in a virtual environment. I don't think that would affect anything. enter image description here enter image description here

Note that these were not actually deleted from my local workspace so nothing was lost, but they stopped getting tracked and consequently were deleted from remote and were not being committed.

To recommit them I had to add them back specifically by name, so not with git add . but with git add ../License

Why is this?

1615903

To recommit them I had to add them back specifically by name, so not with git add . but with git add ../License

You are not in the root directory of your repository. git add . means "add everything from the current directory (.), recursively". It does not propagate to parent directory.

If you run git add . from the root directory of the repository, it does what you expect. You could also do git add -A from any directory within the repository.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

.gitignore and untracked files are shown in git status

.gitignore is not ignoring untracked files

Git untracked files

Git nothing added to commit but untracked files present - even with those files added to gitignore

How do I do a 'git status' so it doesn't display untracked files without using .gitignore?

git still shows files as untracked despite .gitignore and rm -r --cached. What did I do wrong?

Git reports untracked .gitignore file, that does not exist

Windows global gitignore not working... "Untracked files"

How to ignore .gitignore and list ALL UNTRACKED FILES

Git how to delete untracked files

How to pull untracked files with git

List temporarily untracked files in git

Show untracked files as git diff

Git: Ignore untracked files in submodule

how to remove untracked files in Git?

Unwanted untracked files in the snapshot - Git

Git remove new untracked files

Move tracked files to untracked with git

Git: How to get a listing of all untracked files, ignoring untracked submodules?

How to see untracked files in git instead of untracked directory

How can I stop .gitignore from appearing in the list of untracked files?

.gitignore does not ignore untracked *.pb.go files

.gitignore and "The following untracked working tree files would be overwritten by checkout"

Git pulls files in .gitignore

Git ignore files still listed in untracked list

git status showing code in untracked files

Git Dealing with merge conflict with tracked and untracked files

How to add untracked files to commit in git?

Git how to ignore untracked CDT files