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.
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.
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 .
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.
Also instead of adding each file manually, we could do something like:
git add --all
OR
git add -A
This will also remove any files not present or deleted (Tracked files in the current working directory which are now absent).
If you only want to add files which are tracked and have changed, you would want to do
git add -u
What is the difference between git add .
& git add --all
?
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.
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