Git 有一個名為 filter branch 的高級命令,用于對 repo 的 git 歷史進行各種復雜的更改。我打算用它來修復我的 repo 中的一些意外錯誤,但我沒有經驗,我想確保我不會不小心做錯了什么。
一旦我應用了我的 git filter 分支命令,我將最終得到一個改變了 git 歷史的新存盤庫。我想將它與 filter 分支之前的那個進行比較,以確保我想要的那些更改已經完成。
通過做一個簡單的遞回差異,我可以檢查repo的最終狀態是否符合預期。但是歷史呢?如果我比較.git目錄,我懷疑它不會有太大幫助。我還能做些什么來查看所有分支中兩個存盤庫之間的哪些提交不同?
uj5u.com熱心網友回復:
首先,對單獨的克隆進行過濾操作,以便在需要時輕松回傳原始狀態。
另外,您將能夠git log在每個存盤庫中執行一個以進行比較。
其次,考慮使用git filter-repo而不是過時的git filter-branch.
uj5u.com熱心網友回復:
從技術上講,您將在同一個存盤庫中擁有所有提交(前后filter-branch/ filter-repo)。
您可以檢查您的 reflog,發現相關的提交,并將它們與git log或一起使用git diff。
您可以使用每個分支的 reflog 來掃描較短的提交串列:
git reflog target/branch
# you can either use the shas listed in the reflog,
# or the '@{xx}' references mentioned next to them :
git log --graph --oneline target/branch@{3} target/branch
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/372627.html
上一篇:如何在CSS中懸停時更改影像源?
