this prolebme is mainly because of bad wifi connection in the cafe I am in. I did a number of changes on my local repo, eveyr time I did one I would push properly. The latest one I did the Internet connection was on and off, so It did push and git log would show the commit , but git status showed a discrepancy between my local and remote.
Since my last push was a success, I thought I would do this
git fetch origin
git reset --hard origin/master
But crap, this got rid of all commit I did today and head is now some commit I did yesterday, and when I go to bitbucket to see the repo it doesn;t even show today's changes.
Someone please tell me I didn't just screw myself over? is there a solution for this?
Check the git reflog
to see commit hashes for all your recent activity.
Git won't garbage collect unreachable commits for at least 2 weeks (unless you explicitely tell it to)
Alternatively, git log -g
might help you:
-g, --walk-reflogs
Instead of walking the commit ancestry chain, walk reflog entries from the most recent one to older ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With