Stackoverflow Visual Studio Code How to Upload Local Project to Exisitng Repo on Github

Working with GitHub in VS Lawmaking

GitHub is a cloud-based service for storing and sharing source lawmaking. Using GitHub with Visual Studio Code lets you share your source code and interact with others right within your editor. There are many means to interact with GitHub, for case, via their website at https://github.com or the Git command-line interface (CLI), but in VS Lawmaking, 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 lot'll need to create a GitHub account and install the GitHub Pull Requests and Issues extension. In this topic, we'll demonstrate how you tin use some of your favorite parts of GitHub without leaving VS Code.

If you're new to source command or desire to learn more nigh VS Code's basic Git support, y'all tin can starting time with the Version Control topic.

Getting started with GitHub Pull Requests and Problems

Once you lot've installed the GitHub Pull Requests and Bug extension, you'll demand to sign in. Follow the prompts to cosign with GitHub in the browser and render to VS Lawmaking.

Extension Sign In

If y'all are not redirected to VS Code, you can add your authorization token manually. In the browser window, you volition receive your dominance token. Copy the token, and switch back to VS Code. Select Signing in to github.com... in the Status bar, paste the token, and hitting Enter.

Setting up a repository

Cloning a repository

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

Clone Repository button in the Source Control view

From the GitHub repository dropdown y'all 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 you run any Git action in VS Lawmaking that requires GitHub authentication, such every bit pushing to a repository that you're a member of or cloning a private repository. You don't need to take whatsoever special extensions installed for authentication; it is congenital into VS Code so that you can efficiently manage your repository.

When you lot practice something that requires GitHub authentication, you'll run across a prompt to sign in:

Authentication Prompt

Follow the steps to sign into GitHub and return to VS Lawmaking. If authenticating with an existing repository doesn't work automatically, you may need to manually provide a personal access token. Run into Personal Access Token authentication for more information.

Note that there are several means to authenticate to GitHub, including using your username and countersign with two-factor hallmark (2FA), a personal access token, or an SSH fundamental. See Almost authentication to GitHub for more information and details well-nigh each option.

Annotation: If you'd like to work on a repository without cloning the contents to your local machine, you can install the GitHub Repositories extension to browse and edit directly on GitHub. You can learn more below in the GitHub Repositories extension section.

Editor integration

Hovers

When yous have a repository open and a user is @-mentioned, you can hover over that username and come across a GitHub-style hover.

User Hover

There is a similar hover for #-mentioned outcome numbers, full GitHub outcome URLs, and repository specified issues.

Issue Hover

Suggestions

User suggestions are triggered by the "@" grapheme and result suggestions are triggered by the "#" character. Suggestions are available in the editor and in the Source Control view's input box.

User and Issue suggestions

The problems that announced 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 testify these suggestions using the settings GitHub Bug: Ignore Completion Trigger (githubIssues.ignoreCompletionTrigger) and GitHub Issues: Ignore User Completion Trigger (githubIssues.ignoreUserCompletionTrigger). These settings accept an array of linguistic communication identifiers to specify the file types.

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

Pull requests

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

Pull Request View

The queries used to brandish pull requests tin 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

Once you accept committed changes to your fork or branch, y'all tin employ the GitHub Pull Requests: Create Pull Request control or the Create Pull Request button in the Pull Requests view to create a pull request.

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 equally well as fill in details such as the title, description, and whether information technology is a draft PR. If your repository has a pull asking template, this will automatically be used for the description.

Create Pull Request view

Once y'all select Create, if y'all take not already pushed your co-operative to a GitHub remote, the extension will enquire if yous'd like to publish the branch and provides a dropdown to select the specific remote.

The Create Pull Request view now enters Review Style, where you lot tin can review the details of the PR, add together comments, reviewers, and labels, and merge the PR once information technology'due south ready.

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

Reviewing

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

Pull Request Description editor

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

Changes in Pull Request view

The diff editors from this view use the local file, then file navigation, IntelliSense, and editing piece of work as normal. You lot tin add comments inside the editor on these diffs. Both calculation single comments and creating a whole review is supported.

When y'all are done reviewing the pull request changes you can merge the PR or select Exit Review Mode to go dorsum to the previous branch you lot were working on.

Bug

Creating problems

Bug can be created from the + button in the Issues view and by using the GitHub Issues: Create Issue from Selection and GitHub Bug: Create Outcome from Clipboard commands. They can also be created using a Code Activeness for "TODO" comments. When creating issues, you can take the default clarification or select the Edit Description pencil icon in the upper right to bring upward an editor for the issue body.

Create Issue from TODO

You can configure the trigger for the Lawmaking Action using the GitHub Problems: Create Upshot Triggers (githubIssues.createIssueTriggers) setting.

The default issue triggers are:

                      "githubIssues.createIssueTriggers"            : [                                    "TODO"            ,                                    "todo"            ,                                    "Issues"            ,                                    "FIXME"            ,                                    "Consequence"            ,                                    "HACK"            ]                  

Working on issues

From the Issues view, you can run into your bug and work on them.

Issue view with hover

By default, when you commencement working on an issue (Get-go Working on Outcome context carte du jour item), a branch volition be created for you, as shown in the Condition bar in the image below.

Work on Issue

The Condition bar as well shows the active issue and if y'all select that item, a list of effect actions are available such equally opening the issue on the GitHub website or creating a pull request.

Issue Status bar actions

You can configure the name of the branch using the GitHub Issues: Issue Branch Title (githubIssues.issueBranchTitle) setting. If your workflow doesn't involve creating a co-operative, or if you want to be prompted to enter a branch name every time, yous tin can skip that step by turning off the GitHub Issues: Use Branch For Bug (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 exist populated with a message, which can be configured with GitHub Issues: Working Consequence Format SCM (githubIssues.workingIssueFormatScm).

GitHub Repositories extension

The GitHub Repositories extension lets you chop-chop browse, search, edit, and commit to any remote GitHub repository directly from inside Visual Studio Lawmaking, without needing to clone the repository locally. This can exist fast and convenient for many scenarios, where you just need to review source lawmaking or make a small modify to a file or nugget.

GitHub Repositories extension

Opening a repository

Once you have installed the GitHub Repositories extension, you tin open up a repository with the GitHub Repositories: Open Repository... command 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 yous run the Open up Repository control, you then choose whether to open up a repository from GitHub, open a Pull Asking from GitHub, or reopen a repository that you lot had previously connected to.

If you oasis't logged into GitHub from VS Lawmaking earlier, you'll be prompted to authenticate with your GitHub account.

GitHub Repository extension open repository dropdown

Y'all can provide the repository URL directly or search GitHub for the repository yous want by typing in the text box.

Once you have selected a repository or Pull Request, the VS Code window will reload and you lot will see the repository contents in the File Explorer. You tin can and so open files (with total syntax highlighting and bracket matching), make edits, and commit changes, just like yous would working on a local clone of a repository.

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

Another feature of the GitHub Repositories extension is that every time you open a repository or branch, you get the up-to-appointment sources available from GitHub. You don't need to remember to pull to refresh as you would with a local repository.

Switching branches

You tin easily switch between branches by clicking on the branch indicator in the Status bar. One great feature 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 tin can quickly reopen remote repositories with the Remote Explorer available on the Activity bar. This view shows you 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 lot tin can create a new PR from the Source Control view. You'll be prompted to provide a title and create a new branch.

Create a Pull Request button in the Source Control view

Once you have created a Pull Request, you can use the GitHub Pull Asking and Bug extension to review, edit, and merge your PR as described before in this topic.

Virtual file organisation

Without a repository'south files on your local motorcar, the GitHub Repositories extension creates a virtual file organisation in retentiveness so you can view file contents and brand edits. Using a virtual file system ways that some operations and extensions which assume local files are non enabled or take express functionality. Features such as tasks, debugging, and integrated terminals are not enabled and you can learn about the level of support for the virtual file organisation via the features are not available link in the Remote indicator hover.

Remote indicator hover with features are not available link

Extension authors can learn more about running in a virtual file system and workspace in the Virtual Workspaces extension writer'southward guide.

Go along Working on...

Sometimes you'll want to switch to working on a repository in a evolution environment with support for a local file arrangement and full linguistic communication and development tooling. The GitHub Repositories extension makes information technology like shooting fish in a barrel for you to clone the repository locally or into a Docker container (if you have Docker and the Microsoft Docker extension installed) with the GitHub Repositories: Go along Working on... command available from the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) or by clicking on the Remote indicator in the Status bar.

Continue Working on command in Remote dropdown

If y'all are using the browser-based editor, the "Continue Working On..." command has the options to open the repository locally or within a deject-hosted environment in GitHub Codespaces.

Continue Working On from web-based editor

rogersobbect.blogspot.com

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

0 Response to "Stackoverflow Visual Studio Code How to Upload Local Project to Exisitng Repo on Github"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel