Home Account

git delete remote tag script

2015-08-27 18:45 dennis iversen

Tags: php git

Copy the following code, create a file called e.g. git_tag_delete.sh, and place it in a bin dir. Make it executable with chmod +x git_tag_delete.sh. Then run it as e.g. git_tag_delete.sh 1.3.234. Now your remote tag will be gone.

#!/usr/bin/env php
<?php

/**
 * Delete Remote tag: 
 * Usage git_tag_delete 1.0.234
 */

if (isset($argv[1])) {
    $tag = $argv[1];
} else {
    echo "Set tag to delete as argument" . PHP_EOL;
    die();
}

$git_delete = "git tag -d $tag ";
system($git_delete);
$git_push = "git push origin :refs/tags/$tag";
system($git_push);

This page has been requested 3613 times