gpt4 book ai didi

linux - 混帐 : reverts changes other than one specific files

转载 作者:太空宇宙 更新时间:2023-11-04 11:18:45 25 4
gpt4 key购买 nike

git revert HEAD 恢复所有更改,但我想恢复除了我的 go 扩展文件之外的那些?我想还原所有更改,但带 *.go 的更改除外

我试过了

   git revert HEAD ^*.go
git revert HEAD *.go?

它们都不起作用。我应该在哪里查找此功能?

谢谢~!

最佳答案

可能有更好的方法,但应该有效:

git revert --no-commit HEAD
git reset HEAD -- *.go
git checkout -- *.go`
git commit

或者你可以用另一种方式处理它,而不是使用 revert,检查你想要从旧提交中恢复的文件:

git checkout <commit> -- <paths to revert>
git commit

关于linux - 混帐 : reverts changes other than one specific files,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19557159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com