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
Enter the command to initialize the git warehouse
$ git init
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 //查看修改内容
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!