如何恢复部分提交?

时间:2014-04-17 22:16:39

标签: git revert git-revert

在我们的回购历史中有一个提交,推送等。我有SHA,我想运行相当于git revert /one/folder/* THESHAID,但git revert看起来不能只更改特定文件夹。

有没有办法复制该功能?

1 个答案:

答案 0 :(得分:1)

这很奇怪,毫不奇怪,它没有按钮,特别是当蛮力方法如此简单时:

git revert that_commit           # do the whole revert
git reset --hard HEAD^           # in what turns out to have been a throwaway commit
git checkout HEAD@{1} -- one/folder   # and just take what you want of the results