[. NET object-oriented programming advanced] (25) Team development tool (iv) Distributed version control system git--use Gitstack+tortoisegit graphical interface to build git environment "go"

Source: Internet
Author: User
Tags git workflow git client version control system

Transferred from: http://www.cnblogs.com/yubinfeng/p/5182271.html

The previous two code management tools, VSS and SVN, have been used to facilitate our code management for a long time, and this article introduces a completely different (and also irrational) version control system--git. It can be said that git is very fire, which is closely related to the design idea of the designer's sword-pointing pifo. Git uses divergent thinking management code, the biggest feature is the distributed, he can let the developers from different regions work together to complete a work, so that each developer can play a personality, but also by the initiator (i.e., the project manager) unified release of the new version. Developers in various regions can also be developed offline, so that version management system fire, and today's society is inseparable from the innovative atmosphere. With Git you can unleash your imagination and open-source spring has arrived, let's sail it!

1. Introduction to Git

Name: Git (git's pronunciation is/g?t/, open source, free, distributed version control system)

Manufacturer: Linux creator Torvalds, designed for better open source projects, originally for Linux, is now available in linux,unix,max,windows various systems

Features: distributed versioning, metadata storage instead of file mode, git content storage using the SHA-1 hashing algorithm to ensure the integrity of the code content, too many let us dig slowly.


(1) Distributed: Speaking of the advantages, most of them are relative to other management work such as SVN, the biggest advantage is distributed, maximize the development of personality;

(2) Light load: Public server is less stressful because it strengthens the individual and uses metadata storage rather than file form;

(3) High performance: rapid processing of branches, easy to combine, and a branch of conflict resolution is very convenient.

(4) Integrity: Before saving to Git, all data is evaluated for content checksum (checksum), and this result is used as a unique identifier and index of the data. If the file becomes incomplete during transmission, or if the disk is damaged causing file data to be missing, Git can immediately detect it.

(5) Offline: Working offline is an important feature of Git, which is unthinkable in the previous era of exclusive version control.

(6) There are many more ...

disadvantage: Speaking of shortcomings, on the existing version of the control system compared, almost can not find obvious shortcomings, the only obvious is the code confidentiality is poor, once the developer to clone the entire library can fully disclose all the code and version information, which is the author at the beginning of the design goal, The goal is to open source shared world of Datong. Again to say that the shortcomings of the subjective aspect of the comparative learning more difficult points (this do not fear, the following will be introduced slowly), the entire use of the process is not in line with the conventional thinking (this also do not fear, always want to introduce the well).

Upgrade: Open source project, management specification, upgrade timely.

Recommended:★★★★★ (from small to large projects, small to tiny snippets, Android, Facebook, PHP, Spring, mybatis, etc.)

2. Git basics

Git has so many advantages, but most of the tutorials Use command mode, which makes beginners shy, this article uses the graphical interface as much as possible.

Git is a new version of the mind-control system, if you have previously used tools such as VSS,CVS,SVN, then you must not compare the concept of similarity, it is best to forget the previous merger, branching some of the specific implementation patterns. (This slowly unfolds)

Almost all of Git's operations are done locally, which is off-line. No matter where you are, you can be in the development, then how to control the version, do not worry, in your network when convenient to upload changes.

Git does a system calculation when uploading data, minimizing the data transfer, and if the file doesn't change, git won't save it again, but only a link to the last saved snapshot.

Git has a high level of reliability, so as long as you get into the habit of regular push, you can do the experiment on the local computer, do not worry about losing data, how to recover the data, the following will be introduced slowly.

git files have three states: committed (committed), modified (modified), and staged (staged). Submitted indicates that the file has been safely stored in the local database, modified to indicate that a file has been modified, but has not yet been committed, and that a staged representation puts the modified file on the list to be saved on the next commit.

git directly records snapshots, rather than differential comparisons. The main difference between Git and other version control systems is that git only cares about whether the overall file data is changing, while most other systems only care about the specific differences in file content.

If you don't understand, it's okay, take it slow.

3. Basic Git Workflow

(1). Modify some files in the working directory.

(2). Take a snapshot of the modified file and save it to the staging area.

(3). Commit the update to permanently dump the file snapshot saved in the staging area to the Git directory.

Therefore, we can judge the status from the location of the file: if it is a specific version of the file saved in the Git directory, it is a committed state;

If it is modified and placed in the staging area, it is in the staged state;

If it has been modified since it was last removed but has not yet been placed in the staging area, it is the modified state.

We'll take a closer look at the details and learn how to follow up on file status and how to skip staging direct commits.

4.Git Pre-Installation Preparation

4.1 Introduction to the installation package

Finally into the exciting moment, through the above introduction, looking at the very mysterious East, will soon enter our vision.

In this series of articles, I'll just show you how to install git under Windows systems (although using the multi-linux/unix tool under Windows requires a simulation environment, which can be a lot of inconvenience, but most of the students in the country still use Windows), other operating system students please refer to other articles.

Server-side tools:

The official Git Server requires operations such as creating a repository using the command line.

Gitstack Third-party open source server, customized for Windows, integrates with more familiar versions of Git, and web-based operation interface without instructions.

The client tools are as follows:

tortoisegit (TortoiseSVN's brother) graphical interface to do the best git client

Git Extensions (Visual Studio 2013/2015 integrated git client) lets you use Git's graphical client without command-line control

Git-cola is a sleek and powerful git graphical user interface developed by Python

EGit-(Java developer git client plugin) leverages EGit to implement branches, merges, replicates, and synchronizes libraries in eclipse

There are many more, we will focus on Tortoisegit and Git Extensions

4.2 Installation package Download

We download the installation packages we need in the Windows environment

(1) Server-side

For the server-side environment configuration, there is not much information available on the Internet, especially in the Windows environment of the server Building

For those of you who prefer to use the native version of Git, please refer to the following articles:

Windows+git+copssh Way, url:http://blog.csdn.net/aaron_luchen/article/details/10498181 Http://blog.csdn.net/code_ style/article/details/38764203

For git command-line operation of the more complete data, url:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

By the way, the official git

Git server-side Windows version installation package (includes 32-bit and 64-bit, depending on your server OS selection)


Official website Url:http://git-scm.com/download/win

(Note: The server-side environment we will use below does not need to download the original)

But Copssh is not free, and the above environment also need to use some commands to complete some operations (I do not discriminate against the use of command line operation, first of all, this is an introductory article, to be simple, and the server-side building using Linux more appropriate)

Below, I in this article in order to let everybody use git as soon as possible, we also sword Walk Pifo uses the third party pure interface server side Gitstack, he integrates the GIT, therefore our installs the download, does not need specially to download the GIT server side

Because the integration of Apache and Git, this installation package is a little 126M, patience to download it

Prepare the first installation package for download:

Gitstack open source integrated git interface server side

Official website url:http://gitstack.com/download/

The download process is as follows:

(2) Client

Tortoisegit installation package and Chinese language pack (including 32-bit and 64-bit, based on your client OS selection, I take 64-bit as an example)

Official url:http://tortoisegit.org/download/



The download process is as follows:

Download completed three installation packages as follows:

5. Server-Side Installation

Ready to work, we start to install the server side, double-click Gitstack_2.3.8.exe

Note: At this point, if you have this prompt, we need to temporarily shut down the 80 port service, how to shut down, first find out what services occupy 80

Run, CMD, input netstat-aon|findstr "80" to find PID that consumes 80 of the program

Then in task management, find the Stop

Then the installation is complete and the management interface is opened automatically

Default User and Password admin login

How familiar is this interface, similar to SVN, creating repositories, creating groups, creating users, setting

The installation of our server is complete, and using Gitstack to create a Windows-based server is as simple as that. Below we describe its use.

5. Use of Git server-side gitstack

The use of Gitstack is very simple, and the SVN server does not make much difference, first look at the settings

Once the setup is complete, we create a repository and a group and 2 users

Join 2 users to the group

Next, we mygitgroup the repository authorization group so that these two users have the right to operate the repository

First create a repository Mygitobject, with an authorization group or user (here we authorize the group, we have two users in the group)

Add the group Mygitgroup you just built to the repository

Set read and Write permissions for a group

The configuration to this server is complete, and we can see that in the Repository directory we have just created a repository folder Mygitobject.git

Like to use the command line of the classmate, can still open the operation here, you can see the only role of Gitstack, is to help us provide an HTTP service + an interface configuration and, our core is still git

Installation of 6.Git clients

There are many client tools, we choose the "Little Turtle" which has been downloaded earlier.

Locate the Tortoisegit installation package and language pack that you downloaded earlier

Install client Start

Complete the next step, finish, and then install the language pack (like the English version can be completed)

Language Pack, Next, Finish!

After the language pack installation is complete, we find the Tortoisegit settings in the Start menu

Select language: Simplified Chinese

Customer completed! @!

Use of 7.Git client Tortoisegit

Continue to introduce the use of Tortoisegit

7.1 Getting the server version library

Create a git working directory on the local computer first F:\GitWorkArea

Open the directory right-click in the blank, you can see the Tortoisegit menu, the initial operation can choose Git clone, that is, get the server version of the library, you can also choose to create a new version of the library

Since we have already created a repository on the server, we chose to clone.

Here URL we enter, before the server side created the repository address, click OK, then we need to authenticate the user and password, this is necessary, otherwise anyone can clone our version

After the user and password verification is complete, the repository cloning succeeds.

7.2 Creating a new file

Next, you must be eager to create a file and start our Git tour.

Write whatever you want, then save and close.

7.3 Submit

Submit our new file to Repository, very simple, right-click in the work blank

Then click, submit to Master

At this point, there will be a hint that you need to set up an interactive mail

On the setting that pops up, when you're done, OK.

Then fill in the Notes, remember to form a good usage habits, submit to write notes Oh, and then select the file, OK

Submit Complete ~

7.4 Viewing the change log

Before we view the log, we create a file in our work, submit it again, and then open the file again to modify the content submission.

In the working directory, right-click to select Tortoisegit, open "show log"

In the Log window, we can see three changes in the notes and other information, very comprehensive

First come here, unconsciously 4 o'clock in the morning, about the use of tortoisegit will make you constantly pleasantly surprised, the next chapter will continue to introduce the establishment of branches, flexible switching between branches, merging and so very useful functions.

8. Highlights of this section:

The content of this section is more, first let us to git this version of the control system has a preliminary understanding, in order to avoid many articles in the beginning is a variety of command line, let beginners discourage. I chose to start with the simplest server environment configuration, Gitstack, to create a git server side under Windows, and then introduce our familiar "Little Turtle" version of the client tool, the installation and basic use of tortoisegit. More practical features are waiting for us in the next section.

If you like my blog, remember to praise Oh, you can also add QQ Group Exchange, Group No.: 467189533

[. NET object-oriented programming advanced] (25) Team development tool (iv) Distributed version control system git--use Gitstack+tortoisegit graphical interface to build git environment "go"

Related Article

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.