Deleted Git Tags Recover

We recently ran into a tag issue in our Git repository.

We deleted our tags locally and remotely, but they were restored all the time with every click or removal from the remote.

We are currently working in a team of three people, and when we think that we really got rid of the tags, someone will push, and we will all get them again.

We all tried:

git tag -d 12345
git push origin :refs/tags/12345

Has anyone else encountered this problem?

+4
source share
1 answer

Remove the tags again and do the following:

# verify that the tag was removed form another computer
git fetch --all --prune

Important

git <2.0 git, t23 . , .


What else can you try?

# push just the tag name without refs/tags/...
git push origin :tagname

# same as above but with the `--delete` flag instead of `:`
git push --delete origin tagname

# as you already did locally - delete the tag as well
git tag -d tagname

Git hooks

, git, .
, :

#!/bin/sh

log() { printf '%s\n' "$*"; }
error() { log "ERROR: $*" >&2; }
fatal() { error "$*"; exit 1; }

case $1 in
    refs/tags/*)
        [ "$3" != 0000000000000000000000000000000000000000 ] \
            || fatal "you're not allowed to delete tags"
        [ "$2" = 0000000000000000000000000000000000000000 ] \
            || fatal "you're not allowed to move tags"
        ;;

    # personal touch :-)
    echo "                                         "
    echo "                   |ZZzzz                "
    echo "                   |                     "
    echo "                   |                     "
    echo "      |ZZzzz      /^\            |ZZzzz  "
    echo "      |          |~~~|           |       "
    echo "      |        |-     -|        / \      "
    echo "     /^\       |[]+    |       |^^^|     "
    echo "  |^^^^^^^|    |    +[]|       |   |     "
    echo "  |    +[]|/\/\/\/\^/\/\/\/\/|^^^^^^^|   "
    echo "  |+[]+   |~~~~~~~~~~~~~~~~~~|    +[]|   "
    echo "  |       |  []   /^\   []   |+[]+   |   "
    echo "  |   +[]+|  []  || ||  []   |   +[]+|   "
    echo "  |[]+    |      || ||       |[]+    |   "
    echo "  |_______|------------------|_______|   "
    echo "                                         "
    echo "                                         "
    echo "      This is your last time trying to   " 
    echo "      delete or to move our tags. :-)    "
    echo "                                         "

esac

Git v2.0

git push [$there] , , matching ( , ). git 2.0 simple :

  • , ;

  • , , , .

push.default . , matching, matching, . .

+6

Source: https://habr.com/ru/post/1629967/


All Articles