Install and use Git (1). install and use git

Source: Internet
Author: User
Tags git commands

Install and use Git (1). install and use git

I had nothing to do with writing a demo. I wanted to upload it to GitHub and found that I had to use git for upload. So I had to know about git first.

1. What is git?

Distributed version controller

2. Differences between svn and git
Svn: it is a centralized version control system, and the version library is centrally stored on the central server. When working, you must first obtain the latest version from the central server,
After the work is finished, push your work to the central server. The most important thing is that you must connect to the Internet to work with svn.

Git: Everyone's computer is a complete version library, so you don't need to connect to the Internet when you work, because the version library is on your own computer.

Install and use Windows

3. Installation
: Https://git-scm.com/downloads

One-way next installation
After the installation is complete, find "Git"-> "Git Bash" in the Start menu and find something similar to the command line window, which indicates that Git is successfully installed!

4. Create a version Library

First, select an appropriate place to create an empty directory (the directory name and parent directory do not have Chinese characters). For example, create a mypro folder on disk D.

Enter d: \ mypro

$ cd D:\mypro

Enter the command to initialize the git Repository

$ git init

 

In this case, the repository is created and you are told that it is an empty repository (empty Git repository). You can find one more repository under the current directory. git Directory, which is used by Git to track and manage version libraries. Do not manually modify the files in this directory. Otherwise, the Git repository will be damaged. If you do not see the. git directory, it is because the directory is hidden by default, so that the hidden files can be seen.

Below are some common git commands, which will be supplemented later

$ Git add readme. md // Add the file readme. md is the name of the file to be added. It can be used multiple times to add multiple files; $ git commit-m "first commit" // submit the file "first commit" as the remarks $ git status // check whether the status is added, modified, or deleted $ git diff // view the modification content

 

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.