GIT:指南
- 如何高效使用Git
- First to do (use terminal, not gui tool)
- ~/.gitconfig --- gloabal git configration
- git alias
- git terminal tool --- 1.tig 2.diff-so-fancy(全局變量中配置)
- three points ,seven situations
- 分支模型
- 工作分支 隨用隨刪除
- 兩個(gè)主分支(master/develop)
- 注意自己當(dāng)前分支
- Git工作流
- 任何新需求,從develop創(chuàng)建新分支
- 開發(fā)完成和合并新分支到develop,刪除新分支
- 定期合并develop到master
- master只用作上production
- Git提交方式
- 小步提交
- 寫規(guī)范的comment
- nerver 'git commit -m "" '
- Always write comment seperately(git ci)
- Comment format
- GIt rebase (變基)
- 將提交到某一分支上的修改都移交到另外一分支
- 準(zhǔn)側(cè) (只在本地進(jìn)行rebase 操作)
- Git場景
- 開發(fā)一個(gè)新功能
- develop---創(chuàng)建切換新分支
- 開發(fā)完成
- git status, git diff 查看區(qū)別
- git add . 添加全部改動(dòng)文件到新分支
- git commit
- git push
- 更新本地的Repo
- git checkout develop git pull
- 獲取server端的更新并合并到branch
- git checkout develop,
- git pull
- git checkout - (切回到上一個(gè)分支)
- 然后將別的分支 合并到自己分支
- 解決沖突
- 解決沖突
- 提交到自己分支
- git rebase -continue
- 合并bracnh到主分支
- git merge
- git push
- 撤銷一個(gè)提交
- git revert 'commit id'
- 提交到錯(cuò)誤的分支處理
- (一個(gè)hotfix本該提交到master卻提交到develop)
- git checkout develop (切換到develop)
- tig 快速找到commit id
- git checkout master
- git cherry-pick 'commit' 提取hotfix到master
- git push
- 清理分支
- 切換到要?jiǎng)h除的分支
- git unpublish (刪除遠(yuǎn)端的分支)
- git checkout develop
- git br -D branch_name
- 書籍:
- 猴子都能懂的git
- Pro git中文版
- 開發(fā)一個(gè)新功能
- 分支模型