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