Git usage (1) - Repository

1 Introduction

  Git as a distributed version control system, which has the advantage that does not require connecting the distal end of the repository can be used.

  So the distributed version control to achieve a set of specially designed storage section and statement to achieve.

  (1) Local repository: create documents on your local disk folders.

    1) Push the statement by statement to a local repository complete upload / replace the code remote version of the warehouse.

    2) Create / branch switching workspaces by checking statements.

  (2) remote repository: built on a remote server disk folder.

    3) statement by cloning a remote repository complete download code / replacement to the local repository.

    4) remote repository workspace with a different file statements will be updated by pulling.

  (3) the work area: on the local repository project, there is the difference between local and remote warehouse and warehouse isolation.

    5) by adding a statement to the local file repository no / change into the staging area.

  (4) staging area: just as a cache for temporarily storing files from workspace changes and additions submitted.

    6) by submitting statements, changes and additions will be temporarily stored to the local repository.

  Wherein the working area and the staging area are abstract area. There is no modify and add new files to the staging area in the work area, that is, in a project; added to the staging area not to move the file to a folder, but will modify and add the document marked mark; submitted to a local repository in order to modify and add operations to perform remote repository. There are only three kinds of entities local repository, a remote repository and workspace physically. A file transfer only modify the status flag in the middle of a local file repository, work area and staging area, but not actually moving position. Local and remote repository repository there is no real difference, just load the machine to the local repository takes a long time to start, providing more than uploading and downloading, he served as the task of remote repository.

 

2. Create a local repository

  (1) using Git GUI creation

    1) Select an empty folder.

    2) the right to select "Git GUI Here".

    3) 点击"Create New Repository"。

    4) Click "Browse" to select the folder to create a local library, the default is the current folder, click on "Create", is created.

  (2) use to create TortoiseGit

    1) Select an empty folder.

    2) the right to select "Git repository created here."

    3) If either create a private Git repository, do not check the "Make Plain repository" and click OK to create complete.

  (3) created using Git Bash

    1) Select an empty folder.

    2) the right to select "Git Bash Here".

    3) Input:  git the init  , created.

 

3. build private Git repository

  Some need to create in order to protect the code repository in the remote LAN access to new users on the host as a remote repository and then create pure repository. Over IP and login, you can use a remote repository.

  (1) created using Git Bash

    1) Select an empty folder.

    2) the right to select "Git Bash Here".

    3) Input:  git the init --bare  , to create a pure version of the library.

  (2) use to create TortoiseGit

    1) Select an empty folder.

    2) the right to select "Git repository created here."

    3) Check the "Make Plain repository" and click OK to create complete.

 

4. Create a remote repository GitHub

  GitHub is a large open source project based Git repository, many well-known open source projects are saved on it, providing developers to use and learn.

  GitHub open source project providing free remote repository to create and use the service, if you need to create a private library, you will need to upgrade to a paid account.

  Use GitHub to create a remote repository on the premise that the need for a GitHub account, because it is all in English, English is not good may be more difficult, and GitHub server outside, so the access and use of speed slower than. For both inconvenient cloud open source code can be used provided China: https://gitee.com/ , and within 5 yards of the cloud provider private library for free, and Chinese requirements for speed is still very friendly operation with the GitHub almost, not go into details.

  (1) landing GitHub, top right, click "+", select "New repository".

  

  (2) the first empty fill project name, the second fill empty project description.

  

  (3) Select the open source project or private project, the project needs private-paid account.

  

  (4) If checked, the project will create comes with a README file, it does not require general election.

    After a good fill, click on "Create repository", you can create an empty remote repository.

  

Guess you like

Origin www.cnblogs.com/NyanKoSenSei/p/11573772.html