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

来源:互联网 发布:淘宝搜店铺名搜不到 编辑:程序博客网 时间:2024/05/24 02:46

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.
阅读全文
0 0