libgit2 / libgit2/libgit2sharp
Remove tag
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 3.5k
- Forks
- 925
- PR merge metrics
- No merged PRs in 30d
Description
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();
}
}
}
`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Program.Main example, especially the repo.Tags.Remove and repo.Network.Push calls. Read the LibGit2Sharp tag and push API documentation and verify the expected local and remote tag-removal workflow. Done means providing confirmed usage guidance for both operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, git
- Domain
- devtools
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100