mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 12:45:00 +00:00
feature: add pattern to .gitignore by unstaged changes' context menu
This commit is contained in:
parent
20f5a6eb13
commit
89f9eb3d90
6 changed files with 97 additions and 12 deletions
16
src/Commands/GitIgnore.cs
Normal file
16
src/Commands/GitIgnore.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System.IO;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public static class GitIgnore
|
||||
{
|
||||
public static void Add(string repo, string pattern)
|
||||
{
|
||||
var file = Path.Combine(repo, ".gitignore");
|
||||
if (!File.Exists(file))
|
||||
File.WriteAllLines(file, [ pattern ]);
|
||||
else
|
||||
File.AppendAllLines(file, [ pattern ]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue