1. Configure User name and password
$ git config--global user.name "x"
$ git config--global user.email "x"
View User Name
$ git config user.name
2, clone a git repository
Git can communicate through a lot of protocols, with three of the most important protocols, Ssh,http,git (a full-time protocol for GIT services)
Anonymous access: Via git://or HTTP.
Regardless of the protocol used to clone the Git store, the format is: ' Git clone uri ', URI format:
"GIT://(hostname)/(path). Git"
$ git clone git://github.com/xx/munger.git
$ git clone http://github.com/xx/munger.git
3, switch branches
git checkout Master
4, view Log
git log--pretty=oneline
5. deleting files
git rm file name
6, Version fallback
git reset--hard head^
The previous version was head^,
The last version of this is head^^.
7, the deleted file returns the latest
Git checkout--readme.txt
Command git checkout--readme.txt means to undo all changes to the Readme.txt file in the workspace, here are two things
8. View Historical version
Git reflog
10,push to remote libraries
First time push to master with Git push-u origin master
The second push uses git to push Origin master
11. Create Dev Branch and switch to Dev branch
git branch-d branch Name
View branches: Git branch
Create a branch: Git branch <name>
Switch branches: git checkout <name>
Create + switch branches: git checkout-b <name>
Merge a branch to the current branch: git merge <name>
Delete branch: Git branch-d <name>
git log--graph command to see the branch merge diagram.
git log--graph--pretty=oneline--abbrev-commit
12, merging branches
Git merge--no-off-m "merge" Dev
Git Common Commands Summary