I have untracked some folders and files by using .git/info/exclude :
doc
*.txt
doc/*.txt
doc/somefile.txt
But git status says it is still tracked :
$ git st
# On branch dev
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: doc/somefile.txt
Other weird thing is that ls-files
shows it is untracked :
$ git ls-files --ignored --exclude-from=.git/info/exclude
doc/somefile.txt
$ touch /tmp/xxx
$ git ls-files --ignored --exclude-from=/tmp/xxx
$
I am on git version 1.8.1.5
So I conclude I may misunderstand something or do something wrong. Any idea please ?
If git status mentions "Untracked files:", you may need to add one or more untracked files. This status message is OK. We are up-to-date, there is nothing to commit, but there is still an untracked file.
Untracked files are those that are in the repo's directory but have not yet been added to the repo's index with git add .
Untracked basically means that Git sees a file you didn't have in the previous snapshot (commit), and which hasn't yet been staged; Git won't start including it in your commit snapshots until you explicitly tell it to do so.
Since you are locally ignoring files that are in the repository, you need to tell git that you are ignoring them
git update-index --assume-unchanged <files to forget>
You need to git rm --cached <file>
. This doesn't remove the file from your working directory, but it removes it from the git cache
so it'll now be included by the .gitignore
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With