[英]How to undo a pushed commit from remote and local branch in VS Code?
I got stuck.我被困。 I accidently commited and pushed to the wrong branch.我不小心提交并推到了错误的分支。 Is there a way to go back?有办法回去吗? Or to undo that and push it to the right branch?或者撤消它并将其推送到正确的分支? How do you do it in Visual Studio Code?你如何在 Visual Studio Code 中做到这一点? . . I researched and I need to do the 'revert' option.我进行了研究,我需要执行“还原”选项。
Thank you in advanced!提前谢谢你!
You can revert change using git revert [commit_hash]
follow by git push origin [branch_name]
您可以使用git revert [commit_hash]
还原更改,然后使用git push origin [branch_name]
If not sure about your commit_hash value.如果不确定您的 commit_hash 值。 Check using git log
command.使用git log
命令检查。
Here are two links on how to revert using VS Code.这里有两个关于如何使用 VS Code 进行还原的链接。
https://docs.microsoft.com/en-us/visualstudio/version-control/git-manage-repository?view=vs-2022 https://docs.microsoft.com/en-us/visualstudio/version-control/git-manage-repository?view=vs-2022
Is there a way to revert to a previous commit in VS code? 有没有办法恢复到 VS 代码中的先前提交?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.