--- title: Sprint 16 Education tags: MeLoop --- # Sprint 16 Education ## Co-Work 時使用的工具 * 版本控制系統 * Git * cmd * git desktop(不推薦) * git Karken(推薦) ## Why / What is Git * What * Git 為一版本控制系統,可以把檔案的變動作為歷史紀錄保存起來,因此可以記錄過去不同的版本並顯示差異,在改到同一份文件時也會跳出警示。 * Why * 快速的共享專案 * 看到他人的改動,方便管理專案 * 不用擔心覆蓋掉他人的 code ## Git Basic :::info git 的簡單流程如下: 修改 code -> 透過 stage 告訴 git 你修改的部分 -> 用 commit 來建立新的版本 -> 最後再把你的版本 push 上雲端 ::: * commit * 為讓他人快速了解你的修改,需依照以下的 commit 規範 * feat(feature): 新增功能 * fix: 修改 bug * hotfix: 立即的修改 * refactor: 功能不變,但修改 code 的架構 * style: coding style 改變 :::info ex: variable name 1. 小駝峰 littleCamel 2. 大駝峰 LittleCamel 3. UPPERCASE ::: * docs: 新增 document(md、comment、swagger) * test: testing * fellow feat base commit,每開發一個 feature 便發一個 commit * push * 將自己的修改推上雲端 * pull * 下載專案的最新版本 * clone * 複製他人的專案到自己的本地主機 ## Git Flow * PR/MR(pull request & merge request): Prevent from useless request * Fork: Create a new project with the same content from the target repository, user can send MR to the repository. * Git Flow * master / development / hotfix / release / feature * 開發流程 1. master -> develop 2. develop -> feature 3. develop <- feature 4. master <- develop 5. master -> release :::info If hotfix is needed, create a new branch for hotfix and merge to master. Then merge development and release from main. ::: * Github Flow * master / feature / issues(他人回饋) / PR(他人 fork 後推回的更新) * Gitlab * master / release / feature * Our Flow * 現有: main / dev/ feat * 未來: main, dev, feat, uat, production * uat: whcih is for non-developer(ex: PM, QA, deploy the unrelease for testing ## Git Enhenced * Cherry Pick: 多個 commit 中 merge 其中幾個 * Rebase: 把記憶體以時間序還原 commit * Reset: 清空 commit,不會留下紀錄 * Revert: 刪除 commit,但留下紀錄 * squash: 將多個 commit 合成一個 * Tag: 個人使用或是暫時標記歷史紀錄中的版本 * Annotated Tag: 標註歷史中較特別的版本(ex: 發行版本 v1.0) :::info tag vs annotated tag * 資訊量不同 * tag: 只有標籤指向的 commit 訊息 * annotated tag: 會顯示誰在甚麼時候貼這個標籤 :::