internal void AmendCommit()
 {
     if (string.IsNullOrWhiteSpace(Comments))
     {
         Comments = tracker.LastCommitMessage;
         return;
     }
     else
     {
         service.NoRefresh = true;
         if (StageSelectedFiles())
         {
             try
             {
                 ShowStatusMessage("Amending last Commit ...");
                 var id = tracker.AmendCommit(Comments);
                 ShowStatusMessage("Amend last commit successfully. Commit Hash: " + id);
                 ClearUI();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                 ShowStatusMessage(ex.Message);
             }
         }
         service.NoRefresh = false;
         //service.lastTimeRefresh = DateTime.Now;
         //service.NodesGlyphsDirty = true; // force refresh
     }
 }
        public void AmendCommitTest()
        {
            GitFileStatusTracker.Init(tempFolder);
            File.WriteAllLines(tempFile, lines);

            GitFileStatusTracker tracker = new GitFileStatusTracker(tempFolder);

            tracker.StageFile(tempFile);

            tracker.Commit("中文 1čtestč");
            Assert.IsTrue(tracker.LastCommitMessage.StartsWith("中文 1čtestč"));

            File.WriteAllText(tempFile, "changed text");
            tracker.StageFile(tempFile);
            tracker.AmendCommit("new message");
            Assert.IsTrue(tracker.LastCommitMessage.StartsWith("new message"));
        }