git - Understanding .gitignore -
i have .gitignore file in root directory. rule ignore .txt files. in root dir, have 2 files namely, something.py , anything.txt.
i created anything.txt file after writing .gitignore.
so now, when issue git add * ( after making changes in both files ), throws following message: following paths ignored .gitignore file anything.txt. fatal: no files added.
but then, when explicitly add something.py, gets added..
so why isn't .py getting added git add *, though not mentioned in .gitignore file?
when type command git add *
, expanded shell match non-hidden file in current directory. in case, become git add something.py anything.txt
.
git thinks want add file (anything.txt
) matching entry *.txt
in .gitignore
. why throws error. command has failed , no files added.
to add files in project, mustn't rely on shell behavior (* expansion). should using git add -a
or better, adding each logical pack of file individually.
Comments
Post a Comment