File failed to load: /extensions/MathZoom.js 摘取自 http://robbinfan.com/blog/34/git-common-command
将本地库推送到远程库:
or create a new repository on the command line 1. 通过命令行创建一个新的repository
```shell echo “# YiDS” » README.md
git init
git add README.md
git commit -m “first commit”
git remote add origin https://github.com/liuyiyou/YiDS.git
git push -u origin master
```
通过命令行将已经存在的repository推送到远程库
```shell git remote add origin https://github.com/liuyiyou/YiDS.git
git push -u origin master
```
git配置
shell git config --global user.name "liuyiyou" git config -- global user.email "137515110@qq.com" git config --global color.ui true git config --global alias.co checkout git config --global alias.ci commit git config --global alias.st status git config --global alias.br branch git config --global core.editor "mate -w" git config -l #例举所有配置
用户的git配置文件 ~/.gitconfig
git常用命令
查看、添加、提交、删除、找回、重置修改文件 ```shell git help
git checkout –
git add
git rm
git reset
git commit
git revert <$id> #恢复某次提交的状态,恢复动作本身创建了一次提交 git revert HEAD #恢复最后一次提交的状态
```
查看文件diff
```shell git diff
##查看提交记录
shell git log git log
git本地分支管理
查看、切换、创建、删除分支 ```shell git branch -r #查看远程分支 git branch
git checkout
git branch -d
git远程仓库管理
```shell git remote -v #查看远程服务器地址和仓库名称 git remote show origin #查看远程服务器仓库状态 git remote add origin git@github:liuyiyou/liuyiyou.github.io.git #添加到远程仓库 git remote set-url origin git@github.com/liuyiyou/liuyiyou.github.io.git #设置远程仓库(用于修改仓库地址) git remote rm
```