Reputation: 25133
I have next git
history. As you can see I have two servers amazon
and origin
.
History on those servers is differ:
when I do $git push amazon
I get error:
To amazon:/v1/repos/repo
! [rejected] dash_v3 -> dash_v3 (non-fast-forward)
error: failed to push some refs to 'amazon:/v1/repos/repo'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The second amazon
git server is my secondary server.
Is there any options that will allow me say:
It is OK/safe to reorder commits on amazon
server and put 86ccb28a
before 93eeedeb
as it is on origin
server?
And get next history as result:
**PS. I do not want to do git push --force amazon
Upvotes: 1
Views: 90
Reputation: 25133
Answer from IRC #git
chat
kes you need to !rewrite history
Rewriting public history is not recommended. Everyone who has pulled the old history will have to do work (and you'll have to tell them to), so it's infinitely better to just move on. If you must, you can use
git push --force-with-lease <remote> <branch>
to force (and the remote may reject that, anyway). See GIT doc
Upvotes: 2