6

Possible Duplicate:
Github first push problem… how to merge remote changes?

My external repo is fairly outdated. I want to push all my local changes up stream. However, when I attempt to do so I get the following message...

error: failed to push some refs to 'ssh://mylink'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.

I don't want to pull because if I do those external changes will mess up my local changes. How do I override the external?

Community
  • 1
  • 1
Skizit
  • 43,506
  • 91
  • 209
  • 269

3 Answers3

21

git push --force remoterepository

LaC
  • 12,624
  • 5
  • 39
  • 38
  • Be very very careful - this is fine if those "external" changes (commits on the remote not in the local repository) are just your commits from a long time ago, which you've since replaced. But if they're someone else's work, you'll be throwing it away by pushing - in that case, you do need to pull and reconcile before pushing. – Cascabel May 15 '11 at 15:12
0

What about simply overwriting your remote repo?

Rom1
  • 3,167
  • 2
  • 22
  • 39
-1

In my opinion, it's git's protected mechinism. because, someone has pushed sth before you, so you need to pull his reputation and build with your local changes to make sure there is no conflicts. so maybe you should try to pull someone's reputation first, and then push your changes.

piggy_Yu
  • 193
  • 3
  • 11