IOS-Get Git Repository (Distributed version control system)

Source: Internet
Author: User

1. Initialize the warehouse in the existing directory
    • If you plan to use Git to manage an existing project, you only need to go to the project directory and enter the following command.

      # 初始化仓库$ git init
      • This command creates a subdirectory named. Git, which contains all the necessary files in your initialized git repository, which are the backbone of the Git repository. However, at this point, we just do an initialization operation, and the files in your project are not being tracked.
    • If you are initializing a Git repository for versioning in a folder that already has files (rather than an empty folder), you should start tracking these files and submitting them. You can git add implement a trace of the specified file by command, and then execute the git commit commit.

      # 添加所有的 .c 文件# git add [文件名]$ git add *.c# 提交文件到本地仓库# git commit -m [提交内容说明]$ git commit -m "initial project version"
2, cloning the existing warehouse
    • If you want to get a copy of a Git repository that already exists, you need to use the git clone command. Git clones almost all of the data on the GIT repository server, rather than just copying the files needed to complete your work. When you execute the git clone command, each version of each file in a remote Git repository is pulled down by default.

    • The command format for the Clone warehouse is git clone [url] . For example, to clone a Git-linked library libgit2, you can use the following command.

      # git clone [仓库的 url 地址]$ git clone https://github.com/libgit2/libgit2
      • This creates a directory named "Libgit2" under the current directory, and in this directory initializes a. Git folder, pulls all the data from the remote repository into the. git folder, and then reads a copy of the latest version of the file from it.
    • If you want to customize the name of the local repository when cloning a remote repository, you can use the following command.

      # git clone [仓库的 url 地址] [本地仓库名称]$ git clone https://github.com/libgit2/libgit2 mylibgit
      • This will perform the same action as the previous command, but the locally created warehouse name becomes Mylibgit.
    • Git supports a variety of data transfer protocols. The above example uses https:// protocols, but you can also use git:// protocols or SSH transport protocols, for example [email protected]:path/to/repo.git .

IOS-Get Git Repository (Distributed version control system)

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.