[Git Book Pro](http://git-scm.com/book/zh/v2)
[Pro Git中文版](https://0532.gitbooks.io/progit/content/index.html)
## Git相關命令
~~~
# 初始化版本庫
git init
# 查看倉庫狀態
git status
# 將文件提交到版本庫
git add fileName
# 把文件提交到版本庫
git commit -m "這里寫備注信息"
# 將文件從版本庫中刪除并提交
git rm fileName
git commit -m '刪除了文件'
~~~
### 用戶信息
當安裝完 Git 應該做的第一件事就是設置你的用戶名稱與郵件地址。 這樣做很重要,因為每一個 Git 的提交都會使用這些信息,并且它會寫入到你的每一次提交中
~~~
git config --global user.name "curder"
git config --global user.email curder@foxmail.com
~~~
## 檢查配置信息
~~~
git config --list
~~~
你可以通過輸入 `git config <key>` 來檢查 Git 的某一項配置,例如:
~~~
git config user.name
~~~
## Git遠程倉庫 [以oschina為例]
### 把代碼推到遠程倉庫
* 為本地庫添加遠程庫
~~~
git remote add origin https://git.oschina.net/bjphp/testproject.git
~~~
添加1個名為"**origin**"的遠程庫,地址是 https://....testproject.git
* push 推代碼
~~~
git push origin master
~~~
把本地的版本(默認是master),推到名為"**origin**"的遠程庫
### 將遠程庫復制到本地
~~~
git clone https://git.oschina.net/bjphp/testproject.git
# 更新遠程代碼到本地
git pull origin master
# 提交本地代碼到遠程
~~~