I would like to make a git push -mirror that will fail if an immediate update is required forward.
A git push -mirror should fail if the upstream repository is set to receive.denyNonFastForwards true :
git config man page :
receive.denyNonFastForwards
If set to true , git-receive-pack will reject the ref update, which is not a fast forward.
Use this to prevent such an update via push , even if this push is forced .
This configuration variable is set when the shared repository is initialized.
This means you donโt need to โreproduce what --mirror โ: you could just use it and still have this crash on failure if any immediate merge is involved.
source share