git

Git:nothing added to commit but untracked files present


I'm new to Git and is using for the very first time. I would appreciate if someone could help me out. I tried finding the answer at forums,but there are tons of commands that are coming out and not sure which one to use.

On the prod server, if I do the git pull, it is giving me the following error:

Untracked files: (use "git add ..." to include in what will be committed)

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.

I'm not too sure how to make it work. If I remove them, from where would it be removed. Appreciate your reply.


Solution

  • You have two options here. You can either add the untracked files to your Git repository (as the warning message suggested), or you can add the files to your .gitignore file, if you want Git to ignore them.

    To add the files use git add:

    git add Optimization/language/languageUpdate.php
    git add email_test.php
    

    To ignore the files, add the following lines to your .gitignore:

    /Optimization/language/languageUpdate.php
    /email_test.php
    

    Either option should allow the git pull to succeed afterwards.