Pull request

拉取請求可讓您通知其他貢獻者有關 Git 分支的變更。 拉取請求時,您可以先討論並評估建議的變更,然後再將變更執行到主分支。

您最終可以透過建立拉取請求,將變更合併回主儲存庫 (或 repo)。 但是,需要注意的是,在對原始代碼進行任何變更之前,GitHub 會創建一個 fork(或專案的副本),即使變更無法推送到另一個 repo,也可以將變更提交到 fork 副本。

任何人都可以透過拉取請求中的內嵌註解提出變更建議,但在合併變更之前只有擁有者有審查和批准變更的權利。 若要建立拉取請求:

官方教學:Creating a pull request

您可以通過保留提交來合併拉取請求。 以下是您在合併拉取請求時可以使用的拉取請求合併選項清單。

Practice

Basic processes

  1. Fork the project you're interested in to your repository (via web)
    • Login to your GitHub repository
    • Visit the project: https://github.com/google/it-cert-automation-practice 
    •  Fork your own copy of this project via GitHub's website
  2. Clone the repository to local
    • git clone https://github.com/google/it-cert-automation-practice
    • cd it-cert-automation-practice
  3. Setup a remote for the upstream repo.
    • git remote -v
    • git remote add upstream https://github.com/google/it-cert-automation-practice
    • git remote -v
  4. Configure Git
    • git config --global user.name "Yourname"
    • git config --global user.email "your@email"
  5. Create new local branch for the fix 
    • git branch improve-username-behavior
    • git checkout improve-username-behavior
  6. Fix and test the code
  7. Commit the changes
    • git status 
    • git add . 
    • git commit 
    • git push origin improve-username-behavior
  8. Create a pull request (PR) (via web)
    1. Login to your forked repository
    2. Go to Pull requests > Create a pull request
    3. Edit the title and the description for the pull request
  9. You can see information about the branch's current deployment status and past deployment activity on the Conversation tab of the upstream repo. .
Tip: 編寫 Commit 訊息時,可以包含要修復的問題編號(123)的參考連結,例如:

Updated validations.py python script.
Fixed the behavior of validate_user function in validations.py.
Fix for #123
Tip: 一旦 Pull Request 新增完成,後續的追蹤與討論需要回到上游的儲存庫的 Pull requests > Conversation 網站。


Revision #6
Created 2 January 2025 19:52:32 by Admin
Updated 7 January 2025 14:27:45 by Admin