Objective
Git is a lover for many programmers, and it's far more powerful than SVN. With Git, you can easily version control, multiple branches for different work development and multi-person collaborative development. For a programmer, you may not have been in touch with Git in your project, but understanding Git is also a basic quality.
Building the development environment
According to your own system environment download different installation package, official website address: https://git-scm.com/download/. If your computer is a window 64-bit, you can download it here: http://download.csdn.net/detail/u010989191/9494907.
How to install it? Very simple, like the installation of QQ program as simple, double-click the installation package, choose the installation path, choose the appropriate configuration environment, has been the next step. After installing Git bash in the installation directory, the following interface appears, indicating that the installation was successful.
Associate GitHub
How do I use it after installing the environment?
1) Start with a GitHub account. If you do not click on the link below to apply for one: Https://github.com/join?source=login. The login interface is as follows:
2) After registering, the SSH public key and private key are generated natively, this is mainly used by the user's local affiliate GitHub account. Enter Ssh-keygen-t rsa-c "[email protected]" in the terminal as shown in:
3) You can then see the key that you just generated in the c:/users/user/.ssh.
4) on the GitHub page click setting to enter the following interface, click SSH and GPG keys. As shown in the following:
5) Click New SSH KEY. Add the public key as shown in:
6) The GitHub account has been linked to this institution. If you don't want this computer to continue working on your GitHub account, just delete ssh key here. Isn't it convenient?
7) Click on the GitHub homepage + to add a repository. The warehouse you added this time is named first. The warehouse name can be freely named, not in conflict with the existing repository name. As shown in the following:
Complete the above steps, which is to build the GIT environment.
To better operate the warehouse, here are a few common Linux commands.
1) pwd. View the directory that is currently located.
2) cd+ space + path. Switch the working directory.
3) LS. The current directory file list.
4) mkdir + space + folder name. Create a folder.
The following shows how Windows switches to G-disk and creates a gitenv folder.
Go to Folder gitenv using the following command: cd gitEnv
The following shows how to do the warehouse above GitHub:
1) Enter the Gitenv folder, create the first folder, and Git init initializes a warehouse environment. As shown in 1, which is the current directory, 2 means that the main branch is the trunk branch:
2) First copy the remote warehouse to the local machine. Input command git clone 仓库ssh网址
Shown in the film:
How do I find the warehouse address? Very simple, as shown in:
2) in order to facilitate the operation of the first warehouse, use the following command to give the warehouse an alias origin.
add origin [email protected].com:jijia-cn/first.git
3) Use git status
to view the status of the current local warehouse. As shown, the current warehouse is a very clean warehouse.
4) I'll show you how to use Git by creating a Readme file as an example.
5) There are many ways to create files, such as Touch Readme and VI Readme or Direct VI Readme. The simplest is the echo "content" > Readme. The following shows how the stream creates a file readme. As shown, use the Cat command to view the contents of the file:
6) Git status to view the status of the current Warehouse branch. As shown in.
7) Git add Readme then check the status as follows:
8) git commit-m "show git How to use" This command is a file that commits git Add. Only local submissions, not pushed to GitHub. The status is as follows:
If prompted to enter User.email and User.Name, you will need to bind to the mailbox of the application account.
9) Just push the readme to GitHub.
GitHub website to view what was just pushed.
Summarize
Write something on the weekends. This article just gives some help to Git's friends, and as for some advanced git gameplay, there will be time to introduce them later. The abyss of misery is boundless. If you have seen friends feel useful, trouble everyone to order a praise, also is to me to organize these hours of a recognition! Thank you!
"Talking about how Git uses"