Skip to content

Instantly share code, notes, and snippets.

@benoitjadinon
Created January 25, 2012 22:17
Show Gist options
  • Select an option

  • Save benoitjadinon/1679213 to your computer and use it in GitHub Desktop.

Select an option

Save benoitjadinon/1679213 to your computer and use it in GitHub Desktop.
Mono command line pseudo-bash script, that renames git tags by adding a 'v'
using System;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace GitRenameAllTags
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine("running in " + Directory.GetCurrentDirectory()+", ok ?");
Console.ReadKey();
Console.WriteLine();
ProcessStartInfo start = new ProcessStartInfo ("git","tag") {
UseShellExecute = false,
RedirectStandardOutput = true
};
using (Process process = Process.Start(start))
{
using (StreamReader reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
var lines = Regex.Split(result, "\n");
foreach (var tag in lines) {
if (tag.StartsWith("1.")){
Console.WriteLine("-> " + tag);
Process.Start("git","tag v"+tag+" "+tag);
Process.Start("git","tag -d "+tag);
Process.Start("git","push emastore :refs/tags/"+tag);
Process.Start("git","push dropbox :refs/tags/"+tag);
}
}
}
}
Process.Start("git","push --tags");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment