Git只提交一些文件
这个问题在这里已经有了答案:
你可以使用git checkout:
git checkout HEAD~ -- file/to/revert
从以前的提交中分级文件的一个版本。 然后,只需进行修改,您就可以开始了! 当然,你可以用引用前一个提交的HEAD~
替换为一个提交的散列,一个后面的祖先,或者你希望的任何“tree-ish”对象。
我在github上提交了一些我想改变的提交。
我只需要恢复其中一些更改
几个选项:
从所需的提交中检出所需的文件
git checkout <commit> path/to/file
交互式重新分配
// X is the number of commits you wish to edit
git rebase -i HEAD~X
一旦你压缩了你的提交 - 选择e
来编辑提交。
链接地址: http://www.djcxy.com/p/8973.html
上一篇: Git revert just some files in commit
下一篇: Git reset single file in feature branch to be the same as in master