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
  • 三個主要角色: Working Tree, Index, Repository
  • 修改commit (git reset)
  • 手動瀏覽/查找舊的commit
  • 修改最新的commit
  • 取消commit

Was this helpful?

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

4.1.2.commit

Previous4.1.1.Working tree, Index/Cache, Repository and ObjectNext4.1.3.cherry-pick

Last updated 5 years ago

Was this helpful?

三個主要角色: Working Tree, Index, Repository

  • Working Tree(工作目錄):

    • Git管理的實體資料夾, 也是實際操作的資料夾(檔案)

  • Index (系統索引):

    • 存放一堆需要被commit的(異動)文件內容集合, 把檔案加入索引稱 Stage 或 Cache

  • Repository

    • 是Git存放檔案的位置, 許多commit結點(版本)紀錄於此

修改commit (git reset)

  • git reset就是重置HEAD

    • --soft:

      • working tree, Index未改變, 就只是改變repository (commit)

      • 所有的東西仍在準備狀態, 因此可以有另一次送交的機會

        • 1.取消最新一次的commit

          • git reset --soft HEAD^

        • 2.重新遞交commit

          • git commit -a -c ORIG_HEAD

    • mixed: working tree未改變, 改變Index, repository(commit)

    • --hard

      • 會更改working copy的檔案改回原樣, working tree會被改變, 並重置HEAD

      • 不關心內容

        • 1.取消最新一次的commit

          • git reset --hard HEAD^

        • 2.將取消掉的commit還原回來

          • git reset --hard ORIG_HEAD

手動瀏覽/查找舊的commit

  • 順序

    • 從commit紀錄中找到發生bug及無bug的commit -> 找出後比較兩個commit間的差異

      • 列出所有的commit

              git log               // 等義於git log HEAD
              git log master             //指定branch
              git log --pretty=short master~6..master~4   // 列出master中第4~5次的commit
              git log --all --grep="issue123"    //找出issue123的commit
      • 顯示某個commit的內容

               git show 8244cb97d0c764bbe14c0105f298faf06826d945
      • 比較兩次commit的差異

               git diff f906952b0db01941657067ab67ed1efe06530f8b..8244cb97d0c764bbe14c0105f298faf06826d945

修改最新的commit

  • 順序

    • 1.列出原有的commit

      • git log

    • 2.將修改後的檔案加入修改

      • git add sample.txt

    • 3.將最新的commit修改為這次的commit

      • git commit --ammend

取消commit

  • 順序

    • 1.列出原有的commit

      • git log

    • 2.取消特定的commit

git revert HEAD

git revert (commit)