- Notifications
You must be signed in to change notification settings - Fork 915
git diff{filename} local.patch
Robert N edited this page Oct 25, 2015 · 1 revision
Get a patch file for a single file changed in the working directory (i.e. not committed):
$ git diff myChangedFile.as > myChangedFile.patch var patch = repo.Diff.Compare<Patch> (new List<string>(){"myChangedFile.as" }); using System; using System.Collections.Generic; using LibGit2Sharp; namespace libgitdiff{class MainClass{public static void Main (string[] args){var repo = new Repository ("/your/repo/path"); foreach (var item in repo.RetrieveStatus()){if (item.State == FileStatus.Modified){var patch = repo.Diff.Compare<Patch> (new List<string>(){item.FilePath }); Console.WriteLine ("~~~~ Patch file ~~~~"); Console.WriteLine (patch.Content)} } } } }