共同開發一個專案的小筆記- branch 與 PR

upstream:master <- clone:master is very confusing. In addition, it makes it hard for reviewers to pull your “branch” (actually the master!) to their local.

貢獻一個專案需要注意要用feature branch而不要用master branch發PR,用master branch 發PR會造成專案擁有者的混淆。

並且,在編修完一個issue之後,建議的作法是將feature branch刪除。貢獻一個專案的流程可以參考以下流程:

  1. Fork 屬於solvcon的專案modmesh。
  2. 創建feature branch並在上面做編修。
  3. 用這個feature branch發PR。
  4. 把此feature branch 合併回master。
  5. 刪除feature branch。
  6. 進一步sync專案A。

i.e,

  1. solvon/modesh -> EN/modmesh
  2. git checkout feature1
  3. solvcon:master <- EN:feature1
  4. git checkout master && git merge feature1
  5. git branch -d feature1 and delete the branch on github.
  6. “Sync fork”.

git graph

vscode中的 git graph 可以視覺化git,可以讓開發的進展更一目了然,減少出錯的機會,同時也可以加快熟悉git的腳步。

A starting point for git command

  • git init
  • git clone
  • git add
  • git commit
  • git push
  • git pull