Private Sub Button129_Click(sender As Object, e As EventArgs) Handles Button129.Click Dim lcDirectory As String = "" Dim loProcessFile As Framework.ProcessFile = New Framework.ProcessFile(oApp) ' Based on the selection Select Case GitProject.Text ' Universal Thread Web site Case "Universal Thread Web site" lcDirectory = "d:\iis\Universal Thread" End Select ' Initialization GitCommand.Text = "" ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "status" loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' Initialization GitCommand.Text = GitCommand.Text + "git status" + oApp.cCR ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If End SubCode for the Commit button:
Private Sub Button136_Click(sender As Object, e As EventArgs) Handles Button136.Click Dim lcDirectory As String = "" Dim lcFile As String = "" Dim lcMessage As String = "" Dim lcSHA As String = "" Dim lcTag As String = "" Dim lnCounter As Integer = 0 Dim lnLocation As Integer = 0 Dim loProcessFile As Framework.ProcessFile = New Framework.ProcessFile(oApp) Dim loStringBuilderFile As Framework.StringBuilderFile = New Framework.StringBuilderFile(oApp) ' Initialization GitCommand.Text = "" ' If we do not have any file If GitFile.Text.Length = 0 Then MessageBox.Show("You need to enter a file.", cWindowCaption, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If ' If we do not have any message If GitMessage.Text.Length = 0 Then MessageBox.Show("You need to enter a message.", cWindowCaption, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If ' If we have some tags If GitTag.Text.Length > 0 Then ' Initialization lcTag = GitTag.Text ' Initialization lnLocation = oApp.At(" ", lcTag) ' If we have a space If lnLocation > 0 Then MessageBox.Show("You cannot have a space in a tag.", cWindowCaption, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If ' Initialization lnLocation = oApp.At("'", lcTag) ' If we have a space If lnLocation > 0 Then MessageBox.Show("You cannot have a quote in a tag.", cWindowCaption, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If End If ' Based on the selection Select Case GitProject.Text ' Command Center Case "Command Center" ' Universal Thread Web site Case "Universal Thread Web site" lcDirectory = "d:\iis\Universal Thread" End Select ' Initialization lcFile = GitFile.Text ' Remove carriage returns lcFile = oApp.NoCr(lcFile) ' Load the files into the string builder loStringBuilderFile.LoadString(lcFile) ' For each file For lnCounter = 1 To loStringBuilderFile.nLine ' Get the line If Not loStringBuilderFile.MLine(lnCounter) Then Exit Sub End If lcFile = """" + loStringBuilderFile.cLine + """" ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "add " + lcFile loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' If we have a command If GitCommand.Text.Length > 0 Then GitCommand.Text = GitCommand.Text + oApp.cCR End If ' Initialization GitCommand.Text = GitCommand.Text + "git add " + lcFile + oApp.cCR ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If Next ' Load the files into the string builder loStringBuilderFile.LoadString(GitMessage.Text) ' For each message For lnCounter = 1 To loStringBuilderFile.nLine ' Get the line If Not loStringBuilderFile.MLine(lnCounter) Then Exit Sub End If ' If we have a message If lcMessage.Length > 0 Then ' Initialization lcMessage = lcMessage + " " End If lcMessage = lcMessage + "-m """ + loStringBuilderFile.cLine + """" Next ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "commit " + lcMessage loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + "git commit " + lcMessage + oApp.cCR ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + "git push -u origin master" + oApp.cCR ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "push -u origin master" loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If ' If we have some tags If GitTag.Text.Length > 0 Then ' If we have a command If GitCommand.Text.Length > 0 Then GitCommand.Text = GitCommand.Text + oApp.cCR End If ' Initialization GitCommand.Text = GitCommand.Text + "git rev-parse HEAD" + oApp.cCR ' Load the tags into the string builder loStringBuilderFile.LoadString(GitTag.Text) ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "rev-parse HEAD" loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If ' Initialization lcSHA = loProcessFile.cOutput ' Just take the first seven characters lcSHA = Mid(lcSHA, 1, 7) ' For each tag For lnCounter = 1 To loStringBuilderFile.nLine ' Get the line If Not loStringBuilderFile.MLine(lnCounter) Then Exit Sub End If lcTag = loStringBuilderFile.cLine ' Initialization lcTag = Trim(lcTag) ' If we have a tag If lcTag.Length > 0 Then ' If we have a command If GitCommand.Text.Length > 0 Then GitCommand.Text = GitCommand.Text + oApp.cCR End If ' Initialization GitCommand.Text = GitCommand.Text + "git tag " + lcTag + " " + lcSHA + oApp.cCR ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "tag " + lcTag + " " + lcSHA loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If End If Next ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + "git push --tags origin master" + oApp.cCR ' Framework loProcessFile.cWorkingDirectory = lcDirectory loProcessFile.cFileName = "C:\Program Files\Git\cmd\git.exe" loProcessFile.cArguments = "push --tags origin master" loProcessFile.lWaitForExit = True If Not loProcessFile.Process() Then MessageBox.Show(loProcessFile.cMessage) Exit Sub End If ' If we have an output If loProcessFile.cOutput.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cOutput + oApp.cCR End If ' If we have an error If loProcessFile.cError.Length > 0 Then ' Initialization GitCommand.Text = GitCommand.Text + oApp.cCR GitCommand.Text = GitCommand.Text + loProcessFile.cError + oApp.cCR End If End If ' Reset the values GitFile.Text = "" GitMessage.Text = "" GitTag.Text = "" ' Delete a tag locally ' git tag -d <tag> ' Delete a tag on the server ' git push origin :refs/tags/<tag> End SubThe code is in .NET but that is fairly easy to understand.