Using Git for source control--using Git in VisualStudio

Source: Internet
Author: User
Tags using git

The way git is managed as a source of code is becoming more and more popular, and in VisualStudio 2012, Git is officially supported by the plugin's reality, and the plugin has been regularized in VS2013. Here's a quick introduction to using Git for source control in Visual Studio.

PS: Due to space limitations, this article does not introduce the relevant basic knowledge, before reading this article, assume that you have a certain understanding of git, and the VisualStudio team manager is familiar with, follow up with the time of the introduction of relevant knowledge.

add an item to git source management

Add your project to git source management and just click through the right-click menu of the solution, as you would manage in TFS.

Unlike before, a dialog box will let you choose to manage using either the traditional TFS or git approach, where you can choose Git.

When you're finished, we can see in Team Explorer that the project is already hosted and that you've created a new master branch.

install third-party git tools

From the above we can also see that the team manager view will prompt you to install a third-party git tool. Although not installed can also be used, but VisualStudio in the integration of the features are relatively small (for the time being, is not enough), if you want to use other features, you need to be implemented through a third-party git tool.

Installation method is relatively simple, directly follow the prompts to continue the next step, here is not more introduction. The system itself with Git for Windows, with a command line and a GUI program, command line can be directly launched in VS, more convenient. You can also install other tools on your own, and third-party tools and systems with git do not conflict and can be used at the same time.

Commit Changes

From the team manager we can see that the operation for Git includes changes, branches, and three commits. When we add the project to source control, we first need to submit our changes, here is the "change" function, rather than "submit" (the "Submit" page is published to the GIT server management). After entering the submission page, the user interface is as follows:

The user name and password need to be configured for first use, which is the global setting. Then enter the submit message and click the Submit button to submit. After the submission is complete, you can view the history of all submissions on the branch page.

Create a branch

Creating a branch is simple, just click on the new branch link, select the source branch, and enter a name:

Switch Branches

Once the branch is created, the system automatically switches to the new branch, at which point our modifications are made on the new branch.

If you want to switch branches, double-click the branch directly on the branch page, highlight the selected branch, and the code will automatically switch to the appropriate branch for convenience.

Merging Branches

After the branch is modified, it is often merged into the main line, click the merge link, select the appropriate branch, click the Merge button.

Publish to a git server

Once the local modifications are complete, they need to be published to a GIT server for backup and other members of the project to share. The method of publishing is also relatively simple:

    1. Go to the "submit" page

    2. Select the branch you want to publish

    3. Enter the URL of the Git repository

    4. Click the Publish button

When you first publish, a dialog box prompts you for the identity authentication information for your git repository.

synchronize with Git server to modify

and git server sync modified common commands after fetch, push, pull, in VisualStudio also have to support it, there is not much to introduce.

If you have trouble, you can even click the Sync button to do all the work at once.

cloning a git repository

For team members who are not project creators, the first step is to clone the Git repository. Here's how it works: first select "Connect to Team project" in the Team Manager window, select "Clone" link, enter the URL and local path of the remote Git library, click the Clone button.

Using Git for source control--using Git in VisualStudio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.