我已經做出這樣的承諾
提交哈希 - hash1 -> 更改 = a/1.txt, a/2.txt, b/1.txt
現在我正在恢復此提交, git revert -m 1 hash1但我只想洗掉對檔案夾所做a/的更改但想保留內部的更改b/
是否可以?
uj5u.com熱心網友回復:
您可以使用--no-commit.
git revert --no-commit <commit_id>
git restore --staged b/
git checkout .
git commit
uj5u.com熱心網友回復:
git revert -m 1 hash1
# If needed, resolve conflicts and commit;
# those outside of a/ may be resolved arbitrarily.
git reset --hard HEAD^
git checkout hash1 a/
git commit -C HEAD@{1}
您也可以revert -n在提交之前使用然后重置所有其他目錄;僅當存在許多此類其他目錄時,上面的配方才更可取,因為它僅命名a.
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/371725.html
標籤:混帐
上一篇:向開發分支提交新更改的問題
下一篇:命令列git命令突然要求輸入密碼
