What does it mean when git says a file "needs update"?
Log into your production/destination server, cd
to the directory containing your application and execute those two commands.
1. Reset to the latest version
WARNING, this will delete all your changes:
git reset --hard HEAD
2. Pull the changes
git pull origin master
It means you're trying to merge changes from somewhere, but the changes include modifications to a file that's dirty (currently modified in your working tree). You need to commit your outstanding changes, or stash them, pull/rebase/merge/whatever you're doing to update, and unstash
Like the answer to the linked other question says, the message simply means that you have outstanding changes. You also get this e.g. if you stage some changes with git add
, then change your mind and do git reset HEAD file
with the intention of starting over.
As others have pointed out, needs update message means that the file is dirty or, in other words, outdated. But instead of doing reset and starting all over again, what can be done is simply git status
and then git add <file>
if it's on the changed list. Because you could already add the file before, but then changed it. This happened to me, and with this simple add
I have solved the problem.