banner



How To Upload A Project To Github From Visual Studio

Working with GitHub in VS Code

GitHub is a cloud-based service for storing and sharing source lawmaking. Using GitHub with Visual Studio Lawmaking lets you share your source code and interact with others right within your editor. There are many ways to collaborate with GitHub, for instance, via their website at https://github.com or the Git command-line interface (CLI), but in VS Code, the rich GitHub integration is provided by the GitHub Pull Requests and Issues extension.

Install the GitHub Pull Requests and Issues extension

To get started with the GitHub in VS Code, you'll need to create a GitHub business relationship and install the GitHub Pull Requests and Issues extension. In this topic, we'll demonstrate how you can utilise some of your favorite parts of GitHub without leaving VS Lawmaking.

If you lot're new to source control or want to learn more about VS Code's basic Git support, you can starting time with the Version Control topic.

Getting started with GitHub Pull Requests and Problems

In one case you've installed the GitHub Pull Requests and Issues extension, you'll need to sign in. Follow the prompts to authenticate with GitHub in the browser and return to VS Lawmaking.

Extension Sign In

If you are not redirected to VS Code, you can add together your authorization token manually. In the browser window, you will receive your authorization token. Copy the token, and switch back to VS Lawmaking. Select Signing in to github.com... in the Condition bar, paste the token, and hit Enter.

Setting up a repository

Cloning a repository

You can search for and clone a repository from GitHub using the Git: Clone command in the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) or by using the Clone Repository button in the Source Control view (available when you accept no folder open).

Clone Repository button in the Source Control view

From the GitHub repository dropdown yous can filter and pick the repository you want to clone locally.

GitHub repository dropdown filtered on microsoft/vscode

Authenticating with an existing repository

Enabling authentication through GitHub happens when y'all run any Git action in VS Lawmaking that requires GitHub authentication, such equally pushing to a repository that you're a member of or cloning a private repository. Yous don't demand to have any special extensions installed for authentication; information technology is built into VS Lawmaking so that you lot can efficiently manage your repository.

When yous practise something that requires GitHub authentication, yous'll see a prompt to sign in:

Authentication Prompt

Follow the steps to sign into GitHub and return to VS Code. If authenticating with an existing repository doesn't work automatically, y'all may demand to manually provide a personal admission token. See Personal Access Token authentication for more information.

Note that there are several ways to authenticate to GitHub, including using your username and password with two-factor hallmark (2FA), a personal admission token, or an SSH central. See Near hallmark to GitHub for more information and details nearly each selection.

Note: If yous'd like to piece of work on a repository without cloning the contents to your local motorcar, you can install the GitHub Repositories extension to browse and edit straight on GitHub. You lot tin can learn more than below in the GitHub Repositories extension section.

Editor integration

Hovers

When yous take a repository open and a user is @-mentioned, you can hover over that username and see a GitHub-mode hover.

User Hover

At that place is a similar hover for #-mentioned issue numbers, full GitHub issue URLs, and repository specified issues.

Issue Hover

Suggestions

User suggestions are triggered past the "@" graphic symbol and issue suggestions are triggered by the "#" character. Suggestions are available in the editor and in the Source Command view'southward input box.

User and Issue suggestions

The bug that appear in the suggestion can be configured with the GitHub Issues: Queries (githubIssues.queries) setting. The queries use the GitHub search syntax.

You can also configure which files show these suggestions using the settings GitHub Bug: Ignore Completion Trigger (githubIssues.ignoreCompletionTrigger) and GitHub Issues: Ignore User Completion Trigger (githubIssues.ignoreUserCompletionTrigger). These settings take an assortment of language identifiers to specify the file types.

                      // Languages that the '#' character should non exist used to trigger issue completion suggestions.            "githubIssues.ignoreCompletionTrigger"            : [                                    "python"            ]                  

Pull requests

From the Pull Requests view you can view, manage, and create pull requests.

Pull Request View

The queries used to display pull requests can be configured with the GitHub Pull Requests: Queries (githubPullRequests.queries) setting and use the GitHub search syntax.

                      "githubPullRequests.queries"            : [                          {                                    "label"            :                        "Assigned To Me"            ,                                    "query"            :                        "is:open assignee:${user}"                          },                  

Creating Pull Requests

In one case you have committed changes to your fork or branch, you tin use the GitHub Pull Requests: Create Pull Asking command or the Create Pull Request push in the Pull Requests view to create a pull asking.

Create Pull Request button in the Pull Request view

A new Create Pull Request view volition be displayed where you can select the repository and branch you lot'd similar your pull request to target as well as make full in details such as the title, description, and whether it is a typhoon PR. If your repository has a pull asking template, this will automatically be used for the description.

Create Pull Request view

Once you select Create, if you have not already pushed your branch to a GitHub remote, the extension will ask if you lot'd like to publish the branch and provides a dropdown to select the specific remote.

The Create Pull Asking view at present enters Review Fashion, where you can review the details of the PR, add together comments, reviewers, and labels, and merge the PR once information technology's gear up.

After the PR is merged, you'll have the option to delete both the remote and local branch.

Reviewing

Pull requests tin can be reviewed from the Pull Requests view. You tin can assign reviewers and labels, add comments, approve, close, and merge all from the pull request Description.

Pull Request Description editor

From the Description page, y'all can also easily checkout the pull request locally using the Checkout button. This will switch VS Code to open up the fork and branch of the pull asking (visible in the Status bar) in Review Mode and add a new Changes in Pull Request view from which you can view diffs of the electric current changes as well as all commits and the changes within these commits. Files that take been commented on are decorated with a diamond icon. To view the file on disk, yous can utilise the Open up File inline activity.

Changes in Pull Request view

The diff editors from this view use the local file, so file navigation, IntelliSense, and editing work as normal. You can add comments within the editor on these diffs. Both adding single comments and creating a whole review is supported.

When you lot are done reviewing the pull request changes you can merge the PR or select Get out Review Style to become back to the previous branch y'all were working on.

Bug

Creating bug

Problems tin can be created from the + button in the Issues view and past using the GitHub Bug: Create Upshot from Selection and GitHub Issues: Create Issue from Clipboard commands. They can also be created using a Code Action for "TODO" comments. When creating bug, y'all tin can take the default description or select the Edit Description pencil icon in the upper right to bring up an editor for the issue body.

Create Issue from TODO

You lot can configure the trigger for the Code Action using the GitHub Bug: Create Effect Triggers (githubIssues.createIssueTriggers) setting.

The default issue triggers are:

                      "githubIssues.createIssueTriggers"            : [                                    "TODO"            ,                                    "todo"            ,                                    "Problems"            ,                                    "FIXME"            ,                                    "ISSUE"            ,                                    "HACK"            ]                  

Working on problems

From the Bug view, you can see your issues and piece of work on them.

Issue view with hover

By default, when yous offset working on an consequence (First Working on Result context menu item), a branch will exist created for you, as shown in the Condition bar in the prototype below.

Work on Issue

The Status bar also shows the active outcome and if you select that item, a list of result deportment are bachelor such as opening the issue on the GitHub website or creating a pull asking.

Issue Status bar actions

You lot tin configure the proper noun of the branch using the GitHub Problems: Issue Branch Title (githubIssues.issueBranchTitle) setting. If your workflow doesn't involve creating a branch, or if you lot want to be prompted to enter a branch name every time, you tin can skip that step past turning off the GitHub Issues: Utilize Co-operative For Issues (githubIssues.useBranchForIssues) setting.

Once you are done working on the issue and desire to commit a change, the commit message input box in the Source Control view will be populated with a message, which tin can exist configured with GitHub Bug: Working Issue Format SCM (githubIssues.workingIssueFormatScm).

GitHub Repositories extension

The GitHub Repositories extension lets you lot chop-chop browse, search, edit, and commit to whatsoever remote GitHub repository directly from inside Visual Studio Code, without needing to clone the repository locally. This tin can be fast and convenient for many scenarios, where yous just need to review source code or make a small change to a file or asset.

GitHub Repositories extension

Opening a repository

In one case you lot have installed the GitHub Repositories extension, you tin can open a repository with the GitHub Repositories: Open Repository... control from the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) or by clicking the Remote indicator in the lower left of the Status bar.

Remote indicator in the Status bar

When you run the Open Repository command, you and then choose whether to open up a repository from GitHub, open up a Pull Request from GitHub, or reopen a repository that you had previously connected to.

If you haven't logged into GitHub from VS Code earlier, y'all'll exist prompted to authenticate with your GitHub account.

GitHub Repository extension open repository dropdown

You lot can provide the repository URL straight or search GitHub for the repository y'all want by typing in the text box.

In one case you accept selected a repository or Pull Asking, the VS Code window will reload and you will run across the repository contents in the File Explorer. Y'all can then open files (with full syntax highlighting and subclass matching), make edits, and commit changes, just like y'all would working on a local clone of a repository.

Ane difference from working with a local repository is that when you lot commit a change with the GitHub Repository extension, the changes are pushed directly to the remote repository, similar to if yous were working in the GitHub web interface.

Some other characteristic of the GitHub Repositories extension is that every fourth dimension you open a repository or branch, you become the up-to-engagement sources available from GitHub. You don't need to think to pull to refresh as yous would with a local repository.

Switching branches

Yous tin can easily switch between branches past clicking on the branch indicator in the Status bar. One swell characteristic of the GitHub Repositories extension is that y'all can switch branches without needing to stash uncommitted changes. The extension remembers your changes and reapplies them when you switch branches.

Branch indicator on the Status bar

Remote Explorer

You can quickly reopen remote repositories with the Remote Explorer available on the Activity bar. This view shows yous the previously opened repositories and branches.

Remote Explorer view

Create Pull Requests

If your workflow uses Pull Requests, rather than direct commits to a repository, you tin can create a new PR from the Source Control view. Y'all'll be prompted to provide a title and create a new branch.

Create a Pull Request button in the Source Control view

Once yous have created a Pull Asking, you tin use the GitHub Pull Asking and Issues extension to review, edit, and merge your PR as described earlier in this topic.

Virtual file system

Without a repository's files on your local machine, the GitHub Repositories extension creates a virtual file organisation in memory so you can view file contents and make edits. Using a virtual file system ways that some operations and extensions which assume local files are not enabled or have limited functionality. Features such as tasks, debugging, and integrated terminals are not enabled and you can acquire about the level of support for the virtual file arrangement via the features are not available link in the Remote indicator hover.

Remote indicator hover with features are not available link

Extension authors tin acquire more about running in a virtual file system and workspace in the Virtual Workspaces extension author'due south guide.

Keep Working on...

Sometimes y'all'll desire to switch to working on a repository in a development environment with support for a local file system and full language and development tooling. The GitHub Repositories extension makes it easy for you to clone the repository locally or into a Docker container (if yous have Docker and the Microsoft Docker extension installed) with the GitHub Repositories: Continue Working on... command available from the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) or past clicking on the Remote indicator in the Status bar.

Continue Working on command in Remote dropdown

If yous are using the browser-based editor, the "Continue Working On..." command has the options to open the repository locally or within a cloud-hosted environs in GitHub Codespaces.

Continue Working On from web-based editor

Source: https://code.visualstudio.com/docs/editor/github

Posted by: hannahexis1960.blogspot.com

0 Response to "How To Upload A Project To Github From Visual Studio"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel