Hi everyone,
Today I'll show you how to add your local solution file to a remote repository in GitHub, make changes, and update those changes in the remote repository. So let's begin
First, Create a new project in Visual Studio, I have created a new console application called VisualstudioGithubTest. Or you can open a previously created solution.
Next, we want to click on the Add to Source Control dropdown in the lower right-hand corner.
After that a placeholder called Git comes up, we are then going to click that.
Clicking that will bring up a screen that shows you how to create a git repository.
If you haven't yet connected your Visual Studio to your GitHub account, you can just click the drop-down to add an account and add your GitHub account.
Then you can click on Create and Push
After that, the next thing you will notice is that your repository has been created, and your branch name is on the lower right-hand side of your screen.
Now let us make changes and push to that master branch.
I have changed the Program.cs to reflect a simple loop that displays numbers from 0 to 10
Great, now you can click the Git changes pane at the right of your screen.
You can then write a commit message in the text field that says Enter a message. Since we are only changing the Program.cs file, we can simply click the Commit All button.
After doing that, a small pop notification shows up to tell you the commit has been created locally.
Next, we want to push our changes and update the remote branch with what we have changed locally, so go ahead and click the push arrow, which is the arrow pointing up with an underscore on it.
And that's it! We're done. You can click on the Create a Pull Request button to take you to your online repository on GitHub to see your changes.
I hope you found this useful, Happy coding everyone.
Top comments (0)