Wednesday, December 14, 2011

I was doing my coding in netbean as usual, and was shock to find my changes been replaced and deleted by git. im not sure where went wrong, is it netbean commit that didnt register, or is it git messed up by replacing my commit with its old version.

Wondering how to revert a pull which messed up your code?
git reflog
#example return:

d5ca5a5 HEAD@{0}: pull : Merge made by recursive.
772321b HEAD@{1}: commit: ....
585e66b HEAD@{2}: commit: ....
5a61fe4 HEAD@{3}: commit: ....

git reset 772321b
#reset to a version before the merge was made

then go to netbean and revert all modification done.
This modification basically meants changes that reverse your commit to the older version

then make a copy of the version you have else where.
then run:
git pull
#redo the merge again , which messed up.

#then run meld and compare both directory and put back your latest files and updates into the working directory.
#then recommit your changes.
#then run:
git push

No comments: