Try   HackMD

Git Rebase+GitHub flow 流程

20220210
廖洧杰

video:https://youtu.be/ZCHLOP26glc

大綱

  1. 介紹 rebase 語法,示範網頁
  2. rebase 與 merge 的差異
    • merge:多一個 commit
  3. 發 PR 申請合併
    • PR也會有一個 commit 紀錄

情境模擬

  1. 無衝突(網址):遠端沒有 commit,直接發 PR,並申請合併
  2. 無、有衝突(網址):遠端直接 merge,遠端有新 commit,本地推 feature
  3. 無衝突(網址):Rebase 作法,先下 fetch遠端有新 commit,本地也要推 feature
  4. 有衝突(網址):Rebase 作法,先下 fetch 後解衝突,再推上去

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

好寶寶模式(注意事項)

  1. 做任何事情時,先 git fetch 目前的開發分支,本地處理完再 push
  2. 不要讓審核你 PR 的開發者,在線上解衝突

加上 production 分支(正式上線、客戶)

  • production(正式主機分支): 分支只拿來合併 main 用
    • heroku 自動化佈署
  • main:開發分支
  • feature:開發各個功能用

本次分享用到的指令與軟體

  • 指令
    • git checkout <分支>
    • git fetch vs pull
    • git reflog
    • git reset
    • git add .
    • git commit -m
    • git push
    • GitHub pull request
    • git rebase
    • git merge
    • git branch <分支名稱>
  • 軟體
  • 教學