Git tool installation and usage guide

巴扎黑
Release: 2017-07-21 17:13:13
Original
1662 people have browsed it

I wrote a small demo in my spare time and wanted to upload it to GitHub. I found that I had to use git to upload it, so I had to understand git first.

1. What is git

Distributed version controller

2. The difference between svn and git
svn: It is a centralized version control system. The version library is stored on the central server. When working, it must be obtained from the central server first. The latest version,
After the work is over, push your work to the central server. The most important thing is that svn must be connected to the Internet to work

git: Everyone has a complete version library on their computer, so when you work, you don’t need to be connected to the Internet, because the version library is with you on your own computer.

Windows version installation use

3. Installation
Download address:

all the way next installation
After the installation is completed, find "Git" in the start menu - >"Git Bash". When something similar to a command line window pops up, it means that Git is installed successfully!

4. Create a version library

First choose a suitable place and create an empty directory (the directory name and parent directory should not contain Chinese characters). For example: Create a mypro folder on the D drive

Enter d:\mypro

$ cd D:\mypro
Copy after login

Enter the command to initialize the git warehouse

$ git init
Copy after login

 

This will build the warehouse and tell you that it is an empty warehouse (empty Git repository). You can find more in the current directory. A .git directory. This directory is used by Git to track and manage the repository. Do not manually modify the files in this directory, otherwise the Git repository will be destroyed if the changes are messed up. If you don't see the .git directory, it's because this directory is hidden by default. You can see it by making the hidden files visible.

The following are some commonly used commands in git, which will be added later

$ git add readme.md  //添加文件 readme.md 是需要添加的文件名称  可反复多次使用,添加多个文件;

$ git commit -m "first commit" //提交文件  "first commit"即为备注

$ git status //查看状态 是否新增、修改、删除

$ git diff //查看修改内容
Copy after login

The above is the detailed content of Git tool installation and usage guide. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!