Created
June 26, 2023 08:47
-
-
Save idiotandrobot/e6bce99f6c5ed5b3f4aa5d61e31ba7e3 to your computer and use it in GitHub Desktop.
This file contains 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
string directory = ""; // directory of the git repository | |
using (PowerShell powershell = PowerShell.Create()) { | |
// this changes from the user folder that PowerShell starts up with to your git repository | |
powershell.AddScript($"cd {directory}"); | |
powershell.AddScript(@"git init"); | |
powershell.AddScript(@"git add *"); | |
powershell.AddScript(@"git commit -m 'git commit from PowerShell in C#'"); | |
powershell.AddScript(@"git push"); | |
Collection<PSObject> results = powershell.Invoke(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment