dqdq dqsss
dqdq dqsss

Reputation: 21

How do I push a project to a Github branch in Visual Studio?

All the tutorials and documents I've seen only show how to create a new repository, or to push the project without being able to choose the branch.

I have an existing repo in Github and an existing application in Visual Studio. I want to create an empty branch in the Github repo and add my project in Visual Studio to this.

Note that I haven't connected Github to my Visual Studio application yet.

Is there a simple way to do this in Visual Studio using the GUI?

Upvotes: 0

Views: 49

Answers (2)

Rafael Moreira
Rafael Moreira

Reputation: 430

You authorize git to be used with VSC on settings and probably connect your account to it.

After that, there's a version control tab on VSC.

Version Control Tab Icon

When you go to the 3 dots at the right of the branch row (blue line in this image) you will have access to all options.

Upvotes: 0

Antonio
Antonio

Reputation: 450

I would recommend not to use the GUI, use the terminal to better understanding of git. Please take a look of the Git workfows documentation

You usually need to change to the branch you want to upload:

git checkout <BRANCH_NAME>

If the branch does not exist, you can create by:

git checkout -b <BRANCH_NAME>

Add the files you want to track:

git add <FILES_OR_FOLDERS_TO_TRACK>

Do a commit:

git commit -m 'YOUR_COMMIT_MESSAGE'

Push the branch to the remote (GitHub):

git push origin <BRANCH_NAME>

Upvotes: 1

Related Questions