Simple git push --tags deleted all branches
- Date: Wed, 28 Nov 2018 17:50:49 +0100
- From: Mateusz Loskot <mateusz@xxxxxxxxxx>
- Subject: Simple git push --tags deleted all branches
(using git version 2.19.2.windows.1)
I've just encountered one of those WTH moments.
I have a bare repository
core.git (BARE:master) $ git branch
core.git (BARE:master) $ git tag
I published the repo using: git push --all --follow-tags
This succeeded, but there seem to be no tags pushed, just branches.
So, I followed with
core.git (BARE:master) $ git push --tags
- [deleted] 1.0
- [deleted] 2.0
! [remote rejected] master (refusing to delete the current
error: failed to push some refs to 'XXX'
And, I've found out that all branches and tags have been
wiped in both, local repo and remote :)
I restored the repo and tried out
git push origin 1.0
git push origin --tags
and this time both succeeded, without wiping out any refs.
Could anyone help me to understand why remote-less
git push --tags
is/was so dangerous and unforgiving?!
Mateusz Loskot, http://mateusz.loskot.net