Revert push check in from git
This question already has an answer here:
Two ways:
create a revert commit, and push it. This will have the story look like this:
good commit -> faulty commit -> reverse of the faulty commit
git revert <faultycommitSHA>
git push
rewrite the story, makes the faulty commit as if it never existed
git reset <goodcommitSHA>
If you pushed the bad commit to a server, though, you can't rewrite the story on the server, BUT if you are ABSOLUTELY SURE that there are no other copies of the faulty around you can REMOVE the branch from the server, and push it again. I'll repeat the warning because it is important: DON'T DO IF YOU OR OTHER CONTRIBUTORS PULLED THE FAULTY COMMIT SOMEWHERE ELSE, because you will have conflicts which will merge back the faulty commit into the main branch.
git push origin :branchname # deletes the branch on the origin remote
git push origin branchname # pushes the branch on the origin remote
You can remove the old branch in whatever way you are allowed - for example by using the web interface on GitHub
链接地址: http://www.djcxy.com/p/3160.html上一篇: 如何使用带参数的嵌套命令创建Git别名?
下一篇: 从git恢复推入检入