On Jun 9, 5:53 pm, Dan Z <dza...@yahoo.com> wrote:
> Thanks for the reply. However, this doesn't work. If I try to push
> nothing, I get this error:
> -----> Heroku receiving push
> ! Heroku push rejected due to an unrecognized error. Please try
> again later.
> error: hooks/pre-receive exited with error code 2
> To g...@heroku.com:myapp.git
> ! [remote rejected] master (pre-receive hook declined)
> error: failed to push some refs to '....@heroku.com:myapp.git'
OK, so try the same with the "-f" command-line option, like this:
$ git push -f origin :master :slave
That is, try to force the push.
They could have also prevented forced pushes, but let's try first.
> When I push a branch with a different history (which is what I already
> tried), it simply ADDS to the history. It doesn't replace what was
> already there.
I can't beleive that. Possibly you misunderstand what "different
history" does really stand for.
Different histories mean something like this:
1) Your local branch has the history record like this:
with the tip commit D;
2) Your remote branch has the history record like this:
with the tip commit Z (the bits between [ and ] are common between
so the two histories have diverged since commit "B" (which naturally
can happen if someone pushed X-Z line while you were hacking away
implementing C-D line).
The fact is, in Git, it's impossible to "add" C-D upon X-Z when you
push, this simply can't happen, but the --force (-f) option can be
used to direct Git's remote part to just *throw away* commits X-Z and
replace them with C-D you're pushing. That's what I suggested to do.
If your local branch does not have any common history with remote one,
such forced push will replace the whole history record of the remote
Please don't top-post. This thrashes the discussion flow, which sucks.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at