Last active
November 4, 2020 18:05
-
-
Save KillerGoldFisch/2f8b15f93d844e3d3cbc5e1f2363d795 to your computer and use it in GitHub Desktop.
Reverts all file chenges witch only whitespace changes in a repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget:GCore/1.1.2.42" | |
#r "nuget:LibGit2Sharp/0.26.2" | |
using System; | |
using System.IO; | |
using System.Linq; | |
using GCore.Extensions.StringShEx; | |
using LibGit2Sharp; | |
var repoPath = @"D:\prog\repo"; | |
var repo = new Repository(repoPath); | |
using (var changes = repo.Diff.Compare<Patch>()){ | |
foreach(var ch in changes.Where( c => c.Status == ChangeKind.Modified && (c.LinesAdded == 0 && c.LinesDeleted == 0) && c.IsBinaryComparison == false)) { | |
Console.WriteLine(ch.Path); | |
$"git checkout -- {ch.Path}".Sh(@"D:\prog\tw\LoopAuditioneer"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment