libgit2 / libgit2/libgit2sharp
Remove tag
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
How do I remove a tag and push the removed tag to a remote repo?
I've tried the following but have been unsuccessful, I can query the tags in the repos but I haven't found a way to remove tags and push to the remote.
`
using System;
using System.Collections.Generic;
using System.IO;
using LibGit2Sharp;
namespace GitTagging
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Remove Tags");
using (var repo = new Repository("C:\\src\\repo\\.git"))
{
var allTags = repo.Tags.ToList();
var tagnames = new List<string>();
foreach (var item in allTags)
{
tagnames.Add(item.FriendlyName);
}
StreamWriter file = new System.IO.StreamWriter("C:\\src\\tags.txt");
foreach (string line in tagnames)
file.WriteLine(line);
file.Close();
var tagstodelete = File.ReadAllLines("C:\\src\\tags.txt");
var logList = new List<string>(tagstodelete);
foreach (var item in logList)
{
repo.Tags.Remove(item);
Remote remote = repo.Remotes["origin"];
PushResult pushResult = repo.Network.Push(remote, ":refs/tags/" + item, credentialsLibGit2Sharp);
}
Console.ReadLine();
}
}
}
`
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dall’esempio Program.Main, in particolare dalle chiamate repo.Tags.Remove e repo.Network.Push. Leggi la documentazione delle API di tag e push di LibGit2Sharp e verifica il workflow previsto per la rimozione dei tag locali e remoti. Il lavoro è completato quando vengono fornite indicazioni d’uso confermate per entrambe le operazioni.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- devtools
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100