How to revert the code/files that have been merged to the remote Repo

I pushed the wrong code to the remote Repo and just want to back out the merge.The common way is to use git revert

git revert [the commit you want to back out]

But sometimes I just want to back out several specific files.I do not find a one command way to fix it.Here is the way I use:
- Firstly revert all of the commit:

git revert [the commit you want to revert]
  • Then make the revert files to the workspace.
  • cancel the modification of the files you don’t want to back out
git checkout -- [the files needed cancel]
  • At last just remains the files you want to revert.
文章标签: git revert
个人分类: Questions Git
想对作者说点什么? 我来说一句