git工具下載連接:https://npm.taobao.org/mirrors/git-for-windows/
Git 基本操作
Git 的工作就是創(chuàng)建和保存你項目的快照及與之后的快照進行對比。
本章將對有關(guān)創(chuàng)建與提交你的項目快照的命令作介紹。
Git 常用的是以下 6 個命令:git clone、git push、git add 、git commit、git checkout、git pull,后面我們會詳細介紹。

說明:
workspace:工作區(qū)
staging area:暫存區(qū)/緩存區(qū)
local repository:或本地倉庫
remote repository:遠程倉庫
一個簡單的操作步驟:
git init - 初始化倉庫。
git add . - 添加文件到暫存區(qū)。
git commit - 將暫存區(qū)內(nèi)容添加到倉庫中。
創(chuàng)建倉庫命令
下表列出了 git 創(chuàng)建倉庫的命令:
| 命令 | 說明 |
|---|---|
git init |
初始化倉庫 |
git clone |
拷貝一份遠程倉庫,也就是下載一個項目。 |
提交與修改
Git 的工作就是創(chuàng)建和保存你的項目的快照及與之后的快照進行對比。
常用命令:git status,git add,git commit
下表列出了有關(guān)創(chuàng)建與提交你的項目的快照的命令:
| 命令 | 說明 |
|---|---|
git add [file.../dir] |
添加文件到倉庫 |
git status |
查看倉庫當(dāng)前的狀態(tài),顯示有變更的文件。 |
git diff |
比較文件的不同,即暫存區(qū)和工作區(qū)的差異。 |
git commit -m "info" |
提交暫存區(qū)到本地倉庫。 |
git reset |
回退版本。 |
git reset |
回退版本。 |
git rm |
刪除工作區(qū)文件。 |
git mv |
移動或重命名工作區(qū)文件。 |
提交日志
| 命令 | 說明 |
|---|---|
git log |
查看歷史提交記錄 |
git blame |
以列表形式查看指定文件的歷史修改記錄 |
遠程操作
| 命令 | 說明 |
|---|---|
git remote |
遠程倉庫操作 |
git fetch |
從遠程獲取代碼庫 |
git pull |
下載遠程代碼并合并 |
git push |
上傳遠程代碼并合并 |
設(shè)置全局用戶名和密碼
- git config --global user.name "username"
- git config --global user.email "email"
注意:若使用git push命令的時候出現(xiàn)權(quán)限問題嘗試以下方式解決:
修改項目下.git中的config文件
[remote "origin"]
url = https://github.com/用戶名/倉庫名.git
改為:
[remote "origin"]
url = https://用戶名:密碼@github.com/用戶名/倉庫名.git
GitHub上的快速開發(fā)平臺
1、Jeecg-boot,前端使用阿里ant-desifn-vue
2、renren-fast,spring-boot,vue,element-ui
3、vue-manager-system適合后臺管理
GitHub上的幾個開源項目
1、美人魚
2、微人事
3、bootshiro
4、ooen-capacity-platform
5、V部落
6、悟空CRM
7、paascloud-master
GitHub上的三個電商項目
1、xmall 地址:https://github.com/Exrick/xmall
2、litemall 地址:https://github.com/linlinjava/litemall
3、mall 地址:https://github.com/macrozheng/mall