Git usage and installation details, git Installation Details
Install git (sudo apt-get install git) ubuntu/deepin System
Create a code repository
$ Mkdir gitfolder # create a folder
$ Git init # code repository Initialization
Note: All version controls can only trace changes to text files, but cannot trace changes to binary files.
Change. (Word files are binary files, so they cannot be tracked)
The text editor on windows cannot be used. Because of its development team, the code is processed twice.
It is troublesome to save.
Edit a file named zj.txt and store it in this folder.
$ Git add zj.txt # (submit the modification file) add the file to the price library. After the operation is completed, no messages will be sent to linux.
System Philosophy: "No message is a good message"
$ Git commint-m "description of this submission" # after the submission is complete, information will be returned to you, which information has been changed by high virtualization.
$ Git status # view the changed information library and current information status.
$ Git diff # is used to view different information before and after modification.
$ Git log # view version information (view submission history) $ git reset-hard HEAD ^ /(~ Number)/Several IDCs # version rollback $ git reflog # records the commands you use at work. (Because you must know the id after switching to the git version, but you must change
The command id cannot be seen after the command.) $ git checkout-file name # discard the workspace modification (replace the workspace file with the repository file) $ rm file name # delete a file in the workspace $ git rm # delete a File Remote Repository from the repository (github interaction)
Create an ssh key (The. shh directory will be available in the user directory after the ssh key is created. There are two files, id_rsa (Private KEY) and id_rsa.pub (Public KEY)
$ Git-keygen-t rsa-C "personal mailbox" log on to github and open account setting. Click "add shh key" on the "shh key" page to fill in any title,
Paste the content in the id_rea.pub file in the key. Add a remote database to associate the local database with the remote database
$ Git remote add origin clone remote Repository
$ Git clone <remote repository Name>
Branch Management
Create and merge
1. Create a branch dev
$ Git checkout-B dev # create and switch
2. $ git branch dev # create a branch
$ Git checkout dev # Switch Branch
3. \ $ git branch # view branches (list all branches, and add a * sign before the current branch)
4. \ $ git merge dev # merge dev into and use the merge command on the master Branch (merge the branches into the current Branch)
5. \ $ git branch-d dev # Delete the branch