How do I sort out this git mess? Files on server ahead by two commits -
this question has answer here:
whenever git pull on server, message;
your branch ahead of origin/master 2 commits.
the 2 should in sync. don't know how got here. have in origin/master want on server. don't care if lose changes last couple of commits, nothing vital. how these in sync can push , pull normal again?
edit: ran git checkout origin/master
, got code on server previous state, i'm in detached head state. how out of that?
this message means master branch on server, has commits not in remote. if committed on server , aren't expecting ever commit particular checkout - cause situation.
to see 2 commits are
.. not in remote:
git log origin/master..head # commit messages git diff origin/master..head # diff
to remove these 2 commits
if 2 commits exist don't want keep; change master branch match master branch of remote:
git checkout master # make sure on master branch git reset origin/master --hard # force local history match remote.
to keep these 2 commits
if do want keep commits - push them remote , master branch in sync:
git push origin master
Comments
Post a Comment