6

Possible Duplicates:
How do I push amended commit to the remote git repo?
Undoing a git push

Hi,

I've deleted some commits from my master branch by using

git reset --hard SHA_VALUE

I have, however a remote version of the repository on github, and whenever I git push things, I get an error message, that I should merge the changes contained in the remote repository (which I do not want to).

So my question is, what is the remote equivalent to the git reset command?

thx

Community
  • 1
  • 1
mvaz
  • 308
  • 1
  • 4
  • 10
  • 2
    See here: http://stackoverflow.com/questions/253055 or here: http://stackoverflow.com/questions/1270514 – CB Bailey Feb 16 '10 at 09:23
  • 1
    Thanks! git push origin +master:master did it for me – mvaz Feb 16 '10 at 09:30
  • In that case I'm voting to close as a duplicate of "pushing an amended commit" as it has the same solution and pitfalls as what you are trying to do. – CB Bailey Feb 16 '10 at 09:39

2 Answers2

6

You can use "git push" with "force" option

git push -f

via manpages:

   -f, --force
       Usually, the command refuses to update a remote ref that is not an ancestor of the local ref 
       used to overwrite it. This flag disables the check. This can cause the remote repository to 
       lose commits; use it with care.
silvio
  • 2,174
  • 20
  • 36
1

I think you need to do a "git rebase". Check this article on rebasing and read the section titled "Common Rebasing Use Practices".

ardsrk
  • 2,407
  • 2
  • 21
  • 33