What does it mean when git says a file "needs update"?

I can't for the life of me find any decent explanation of the "[file]: needs update" message that git sometimes spits out from time to time. Even the official git FAQ has explaining this marked as a TODO. If someone could explain A) what it means; and B) how to fix it, I would be extremely grateful.


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


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.


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


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.