
*****
## Git實戰
### 什么是Git
Git是一個分布式的版本控制軟件。
- 軟件,類似于QQ、office等安裝到電腦上才能使用的工具
- 版本控制,類似于畢業論文、寫文案、視頻剪輯等,需要反復修改和保留原歷史數據
- 分布式
- 文件夾拷貝
- 本地版本控制
- 集中式版本控制
- 分布式版本控制
### 為什么要做版本控制
要保留之前所有的版本,以便回滾和修改。
### 安裝Git
Git地址:[https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git](https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git)
### 屌絲創業故事
一個浪跡于北京的屌絲程序猿的終極夢想
### 第一階段:自己寫代碼
版本控制
- 進入要管理的文件夾
- 右鍵 Git Bash Here
- 初始化
- git init
- 管理目錄下的文件狀態
- git status
- 管理指定文件
- git add index.html
- git add .
- 個人信息配置:用戶名、郵箱
```
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
```
- 生成版本
- git status
- git commit -m '描述信息'
- 查看版本
```
git log
```
### 第二階段:拓展新功能
```
git add
git commit -m "短視頻"
```
### 第三階段:約飯功能
- 回滾至之前版本
```
git log
git reset --hard 版本號
```
- 回滾之后版本
```
git reflog
git reset --hard 版本號
```
### 總結
