Wow! This response delayed due to circumstances beyond control. Hope you've resolved the problem already. But, if not ... here goes ...
Qualifications for this response: not a git guru but can google.
Git doesn't normally 'loose track' but it would recognize if a file has changed. Did you maually edit or tinker with the webservices files listed? Hope not as they are core.
The other listing of files look to be mostly addons/plugins. How were those installed?
Have run the git stash before as suggested via git before. Seem to fix and never had issue with that site again. Still made me wonder though. Not long ago discovered yet another 'glitch' ... a git branch -a kept listing two versions at the top and neither had the asterisc marking that one as the one being tracked. There was something network related that prevented git from acquiring what it needed. Git would get to 80% and then stop!!!! ????? Never did figure that out. Share with network folks what we were seeing (they had a rather restrictive VPN setup ... no one could sneeze!). Think network forks relaxed a rule or something cause the next git started to behave as expected.
Via google, found a command to 'reset' git.
First, re-issue the two commands for the branch desired ... need to match what's in version.php of the site -the # symbol below needs to be changed to a digit.
git branch --track MOODLE_3#_STABLE origin/MOODLE_3#_STABLE
git checkout MOODLE_3#_STABLE
That makes sure you've told git which version. They might report 'already tracking' or 'not needed' ... that's a good sign.
Then issue:
git reset --hard
Check the branch ... before pulling the trigger on upgrade.php. Is is the one desired?
git branch -a
update and upgrade went well after that. And as far as I know, the site is still running ok.
'spirit of sharing', Ken