Lion Le
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 前言 在認識完常見 Work Flow 的定義後,我們可以延伸討論一個 Git 指令 - `git fork` 前面文章所討論的 Work Flow,皆是在<u>工程師們已擁有 Repository 編輯權限</u>的前提下,才能正常運行。 那麼在工程師們沒有編輯權限的情況下,我們可以如何做到修改程式碼? </br> # Git Fork 在一些社群共同維護的大型 Open Source 項目,或是第三方團隊所提供的元件項目中,我們通常不會擁有該 Repository 的編輯權限。 此時,如果該項目存在 Bug,便無法對來源端的原始碼協助進行修復,以徹底解決問題。 Frok 叉子,我們可以使用 `git fork` 指令,將原始專案的 Repository 叉回自己的 GitHub,再著手進行後續的 Bug 修復。 </br> # 情境 假設A使用者擁有一個 Open Source Repositroy,其內容是由上萬位工程師們共同維護的 Open Source 項目 ![git fork - 1](https://hackmd.io/_uploads/ByBe8TJekl.jpg) </br> 而 Lion 也想為該 Open Source 項目盡一份心力,在查看 Open Source Repository 的程式碼時,發現某段程式碼可以有更好的寫法。 但 Lion 因為存取權限的關係,無法直接對A使用者的 Open Source Repository 進行編輯或是程式碼的提交。 ![git fork - 2 (1)](https://hackmd.io/_uploads/ByRp7Ize1l.jpg) </br> 這時候 Lion 可以改用 `git fork` 的方式,將A使用者的 Open Source Repository,Fork 回 Lion 的 Repository 對於 Lion 自己的 Lion Repository,Lion 就會擁有完整的存取權限,可以隨意進行編輯、提交或創建分支等所有操作。 ![git fork - 3 (1)](https://hackmd.io/_uploads/rkLkELfgJe.jpg) </br> 在完成程式碼的修改後,Lion 可以先將優化後的程式碼推送至 Lion Repository ![git fork - 4](https://hackmd.io/_uploads/H1FrqTJl1x.jpg) </br> 再從 Lion Repository 向原始專案A使用者的 Open Source Repository 建立 Pull Request(PR)。 當 Lion 的 Pull Request 送出後,A使用者就會收到 Mail 通知。 可以看到 Lion 向 Open Source Repository 所提交的 Pull Request,其中包括異動的程式碼、異動說明等 ![git fork - 5 (1)](https://hackmd.io/_uploads/rkzN7IMlJg.jpg) </br> A使用者可以針對這個 Pull Request 給予反饋或是提出討論 在 Pull Request 的討論過程中,Lion 仍可以持續向 Lion Repository 進行推送,以跟上 Pull Request 的討論內容 ![git fork - 6](https://hackmd.io/_uploads/SJSHlR1lye.jpg) </br> 當確認完 Pull Request 的異動內容後,A使用者可以選擇同意或關閉該 Pull Request。 ![git fork - 7](https://hackmd.io/_uploads/rko9VCyekx.jpg) </br> 同意 Pull Request 後,由 Lion 所異動的程式碼,就會合併至A使用者的 Open Source Repository。 ![git fork - 8 (1)](https://hackmd.io/_uploads/r1L9HEWlyx.jpg) </br> 至此,Lion 就成功為該 Open Source 項目做出了優化的貢獻 </br> # 完整流程圖 ![git fork - 8](https://hackmd.io/_uploads/SyO-LAJeJx.jpg) 1. `git fork` to Lion Repository 2. `git push` modified code 3. Create Pull Request 4. Feedback/Discussion Pull Request 5. Agree/Close Pull Request 6. Merge into original Repository </br> # 總結 執行 `git fork` 指令後,後續流程便與原先介紹的 Work Flow 相同,可以隨意在自己的 Repository 建立/合併分支、提交/推送程式碼等操作。 惟最後多出需要向來源 Repository 建立合併 Pull Request 的步驟。 </br> # 參考資料 https://git-scm.com/book/zh-tw/v2/GitHub-%e5%8f%83%e8%88%87%e4%b8%80%e5%80%8b%e5%b0%88%e6%a1%88 [Will 保哥 - 30 天精通 Git 版本控管 (28):了解 GitHub 的 fork 與 pull request 版控流程](https://ithelp.ithome.com.tw/m/articles/10140305) </br> >[!Tip] 文章內容皆為個人整理的觀點,以及整理後的個人想法,如內容有錯誤或疑慮的部分,歡迎提出討論,收到後會盡快修正!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully