Git – Force overwrite of a remote git with a local git

I had a Google code project for my kernel which I made long ago, and wanted to overwrite it with my updated local git.

First I add the remote:

git remote add googlecode[/code]

Then I force a push:

git push -f googlecode master[/code]


If I do a normal push, this was the error:

git push googlecode master
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to ''
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.[/code]

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.