Debugging, Profiling, Code improvement tools
  • Introduction
  • Chapter1: 追蹤問題
    • 1.1.找出錯誤來源
  • Chapter2: 解決問題
    • 2.1.Check list
      • 2.1.1.確認前後條件
  • Chapter3: 錯誤訊息
    • 3.1.python
      • 'charmap' codec can't decode byte 0x8f in position 17: character maps to <undefined>
  • Chapter4:版本管理工具
    • 4.1.Git
      • 4.1.1.Working tree, Index/Cache, Repository and Object
      • 4.1.2.commit
      • 4.1.3.cherry-pick
      • 4.1.4.rebase
    • 4.2.TortoiseGit
      • 4.2.1.bisect
      • 4.4.2.reflog & reset
      • 4.2.3.blame
  • Chapter5: 除錯工具
    • 5.1.Visual studio
      • 5.1.1.輸出debug訊息
      • 5.1.2.中斷點
      • 5.1.3.載入符號, 檢視堆疊
      • 5.1.4.追蹤點
      • 5.1.5.單步執行程式
      • 5.1.6.日誌
      • 5.1.7.靜態程式分析
    • 5.2. WinDbg
      • 5.2.1.安裝WinDbg
      • 5.2.2.設定project及symbol path
      • 5.2.3.分析.dmp file
    • 5.3.API
      • 5.3.1.核心傾印
  • Chapter6: 效能分析工具
    • 6.1.Introduction
    • 6.2.Windows
      • 6.2.1.效能分析指標
      • 6.2.2.Windows Performance Monitor
      • 6.2.3.Process monitor
      • 6.2.4.Windows Performance Toolkit
    • 6.3.C++ project
      • 6.3.1.SMART BEAR AQ Time
    • 6.4.Python project
      • 6.4.1.cProfile, snakeviz
  • Chapter7: 程式碼優化工具
    • 7.1.Python
      • 7.1.1.vulture
Powered by GitBook
On this page
  • 1.Introduction
  • 2.Getting started
  • 3.rebase的優缺點

Was this helpful?

  1. Chapter4:版本管理工具
  2. 4.1.Git

4.1.4.rebase

Previous4.1.3.cherry-pickNext4.2.TortoiseGit

Last updated 5 years ago

Was this helpful?

1.Introduction

  • 由於branch與master分支的時間點不同, rebase是將branch的commit由舊的分支點移向新的分支點, 藉以讓master上上新的patch

  • 與merge不同的是: merge是直接在master上直接加一個commit, 而rebase是在master上面加上新的commit

  • 兩者的commit graph也不同

    • merge

    • rebase

2.Getting started

  • 1.git log

    • 取得當前分支上的所有commit

  • 2.git rebase -i HEAD~~

    • 將最新的以及次新的commit合併

    • 將第二行的pick改為squash

    • 編輯新的commit message

  • 3.git log

    • 合併成功

3.rebase的優缺點

  • 可讀性佳: rebase的resulting history是線性的, 而且不會有divergent branches

  • 導致錯誤

    • 當branch上所依賴的部分在master上被刪除了, 但是由於在rebase時並不會顯示出來, 因此rebase的執行並不會被中斷而導致一連串錯誤的commit, 這時候必須再加上一個新的commit來補救

    • 所以該如何避免在rebase時一連串錯誤的commit呢?

      • 1.在rebase完後測試code以確認是否有bug

      • 2.用Git merge取代之, 用一個commit處理所有的conflict, 可以history也可以描述何時合併, 合併時修改了哪些東西