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
git svn rebase
with a dirty working copy. Stash save, rebase, stash pop, and all was right with the world. –
Grecism 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.
git reset HEAD file
causes same message to appear –
Breastsummer This error can occur when rebase process make additional changes to files that is not on target branch.
For me the tricky part was with .gitattributes
file in my repo. New binary file type was added in another branch but it's handling was forced as text file. When file was downloaded from repo by git, EOLs (it's binary value bytes actually) was replaced - resulting in binary difference.
Adding new entry to handle new file type as binary and retrying whole process solved problem for me.
In my case, I kept getting
assets/ElipseThree.png: needs update
You must edit all merge conflicts and then
mark them as resolved using git add
I had those files in my directory, but they had been renamed in my current branch. So to fix, I ran
$ git mv assets/ElipseThree.png assets/elipseThree.png
$ git add assets/elipseHalfFull.png
$ git rebase --continue
and it allowed me to continue
© 2022 - 2024 — McMap. All rights reserved.