More Related Content
Similar to Git版本管理控管實戰 (20)
More from Claire Chang (9)
Git版本管理控管實戰
- 8. 儲存庫(Repository)
❖ 本地儲存庫( Local Repository )
❖ 同時包含⼯作⽬錄與儲存庫
❖ 預設位於⼯作⽬錄下的.git 資料夾
❖ 遠端儲存庫( Remote Repository )
❖ 僅儲存庫(Bare Repository)
❖ GitHub / Bitbucket / Visual Studio Team Services / …
❖ 共⽤儲存庫( Shared Repository )
❖ 僅儲存庫(Bare Repository)
❖ 使⽤⽅式跟遠端儲存庫⼀樣
❖ 可以⽤git init--bare建⽴共⽤儲存庫
- 9. 了解Git 資料結構
❖ 物件( Object )
❖ ⽤來保存儲存庫中所有檔案與版本紀錄( 或稱「物件儲存區」)
❖ 屬於⼀種「不可變的」(immutable) 檔案類型
❖ 區分四種物件類型
❖ blob儲存檔案內容
❖ tree儲存⽬錄內容(儲存⽬錄下有哪些檔名)
❖ commit儲存版本內容
❖ tag儲存標籤內容
❖ 索引( Index )
❖ ⽤來保存要進儲存庫之前的所有檔案狀態
❖ 屬於⼀種「可變的」(mutable) 檔案類型
❖ 主要位於.git/index檔案(⼆進位檔)
❖ 介於物件儲存區(object storage) 與⼯作⽬錄(working directory)
❖ 不在索引中的檔案又稱為untracked files
- 11. 查看物件ID / 內容/ 類型/ ⼤⼩
❖ 計算物件編號(object id)
git hash-object filename.ext
❖ 查看物件內容(pretty print)
git cat-file -p a023a56eb2870c106ea9b968ece62604c9d81bb1
❖ 查看物件類型(type)
git cat-file -t a023a56eb2870c106ea9b968ece62604c9d81bb1
❖ 查看物件⼤⼩(size)
git cat-file -s a023a56eb2870c106ea9b968ece62604c9d81bb1
- 19. 合併(Merging)
❖ ⼀般合併
❖ git merge
❖ git merge —no-ff
❖ git merge —squash
❖ git merge —no-commit
❖ git merge —abort
❖ 正向挑選合併(撿櫻桃)
❖ git cherry-pick
❖ git cherry-pick —continue
❖ git cherry-pick —quit
❖ git cherry-pick —abort
❖ 重新指定基礎位置合併
❖ git rebase
❖ git rebase -i
❖ git rebase —continue
❖ git rebase —skip
❖ git rebase —abort
❖ 反向挑選合併
❖ git revert
❖ git revert —continue
❖ git revert —quit
❖ git revert --abort
- 33. 改善建議
❖ 預設改⽤rebase進⾏合併
git config —global pull.ff only
❖ Branch需要更新dev資料時,使⽤rebase取代merge
❖ dev要合併到qat時,加下—no-ff參數
❖ Designer不實際參與GIT操作
❖ 每個⼈⾃⼰⼀個branch(這邊叫Sena branch好了)
❖ 送交:寫好bat檔,點兩下輸入訊息後⾃動做commit和push。
❖ 取得檔案:要切換到不同的QAT單⼯作時,設計⼀個bat檔,點兩
下後輸入單號,該bat檔會⾃動reset Sena branch,然後rebase到
該單號的HEAD。(將本地端未COMMIT的所有之前的⼯作內容
清空)