What is the difference between git push --all
and git push --mirror
?
I only know this:
--all
doesn't push it and --mirror
does.This is correct?
Any other differences?
Apart from your local branches, it also pushes your remote branches, because mirror implies everything. So when you push normally (or with --mirror ), mybranch is pushed and origin/mybranch is updated to reflect the new status on origin. When you push with --mirror , origin/mybranch is also pushed.
Push all of your local branches to the specified remote. Tags are not automatically pushed when you push a branch or use the --all option. The --tags flag sends all of your local tags to the remote repository.
No, git push only pushes commits from current local branch to remote branch that you specified in command.
Sharing Tags If you have a lot of tags that you want to push up at once, you can also use the --tags option to the git push command. This will transfer all of your tags to the remote server that are not already there.
As it says in the documentation:
--all
Push all branches (i.e. refs under
refs/heads/
); cannot be used with other <refspec>.--mirror
... specifies that all refs under
refs/
(which includes but is not limited torefs/heads/
,refs/remotes/
, andrefs/tags/
) be mirrored ...
So a, if not the, key difference is that one means refs/heads/*
and one means refs/*
. The refs/heads/*
names are the branch names. Anything in refs/remotes/
is a remote-tracking name, and anything in refs/tags/
is a tag name. Other notable name-spaces include refs/notes/
, refs/replace/
, and the singular refs/stash
.
The --mirror
option goes on to mention:
locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end.
Hence --mirror
effectively implies both --force
and --prune
; --all
does not. You can, however, add --force
and/or --prune
to git push --all
, if you like.
It is always up to the other Git to decide whether to obey polite requests (those sent without --force
) or commands (--force
) to make changes to its references.
With deleted local branch,
--all
doesn't push it and--mirror
does.
This is a consequence of the --prune
option: telling your Git to use --prune
means "ask them to delete names in their name-space(s) that are not in mine".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With