简体   繁体   English

如何撤消 VS Code 中远程和本地分支的推送提交?

[英]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.

相关问题 如何删除远程推送中的提交但保留本地代码 - How to delete a commit in remote pushed by mistake but keep local code Git-如何撤消在错误的本地分支中的提交? - Git - How to undo commit in wrong local branch? 如何“撤消”推送到远程Bonobo Git Server的提交? - How can I “undo” a commit pushed to remote Bonobo Git Server? 从已经推送的特定提交撤消工作本地文件夹中的更改 - Undo changes in working local folder from specific commit that already pushed 如何在Git中删除已经推送到远程分支并出现在我的同事本地存储库中的提交? - How to delete a commit in Git that is already pushed to a remote branch and present in my coworkers local repos? 如果您已经将文件推送到远程分支,合并到开发分支并且它不是最新提交,如何从 git 中完全删除文件 - How to completely remove a file from git if you already pushed it to the remote branch, merged to the develop branch and it is not the latest commit 目前尚不存在如何从派生存储库到本地的远程分支以及从中推送分支的当前派生存储库的方式 - How to fetch a remote branch from forked repo to local, and currently forked repo from which branch is pushed is not exist VS Code 提交撤消 - VS Code Commit Undo 如何恢复已经推送到远程分支的合并提交? - How to revert a merge commit that's already pushed to remote branch? 撤消克隆远程分支到本地 - Undo clone remote branch to local
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM