是否有可能以某种方式设置一个像往常一样工作的 git 存储库 --mirror 用于拉入它,但在从它推送到另一个 repo 时不强制?
3 回答
您可以添加 --no-force 来禁用强制行为,如下所示:
git push --mirror --no-force
这将禁用非快进更新(使用 git 1.8.0.2 测试)。
I'd like to do a git push --mirror that will fail if a non-fast forward update is required.
A git push --mirror should fail if the upstream repo has its config set to receive.denyNonFastForwards true
:
receive.denyNonFastForwards
If set to
true
,git-receive-pack
will deny a ref update which is not a fast-forward.
Use this to prevent such an update via a push, even if that push is forced.
This configuration variable is set when initializing a shared repository.
That means you wouldn"t have to "reproduce what --mirror
" does: you could simply use it, and still have that push fail if any non-fastforward merge is involved.
有没有办法重现 --mirror 对其他选项的作用?
镜像的某些功能可以通过多次推送来执行:
git push <remote> --all # push all branches
git push <remote> --tags # push all tags
git push <remote> refs/remotes/* #push the remote refs