. Advertisement .
..3..
. Advertisement .
..4..
Hi everyone, I’m learning about git. While working, I try do the git pull on the prod server. As a result, I get the message:
Optimization/language/languageUpdate.php
email_test.php
nothing added to commit but untracked files present (use "git add" to track)
Please move or remove them before you can merge.
What can I do about the “nothing added to commit but untracked files present” issue? Is there a better approach?
The cause: This error happens because you add files to your local machine and then try to pull a remote copy of a repository without adding those files to the repository.
The solution: To fix this error, you may either add the untracked files to your Git repository (as advised by the warning message) or add them to your
.gitignore
file.Using
git add
to add the files:Add the following lines to your
.gitignore
file to ignore the files:After that, either option should allow the
git pull
to succeed.We could also do this instead of manually adding each file:
OR
This will also delete any files that are not present or deleted (Tracked file in the current work directory which are currently absent).
You would only need to add files that are tracked and have been modified.
What’s the difference between
git add .
andgit add --all
?