我正在尝试使用 Git 下的 Visual Studio 团队资源管理器。但是,当我点击 时
这,我可以回到我以前的版本,它不能,因为有传入的提交再次回到最新的错误版本......
我尝试单击还原并不能帮助我再次返回到以前的版本。任何人都可以帮助如何在没有传入提交的情况下返回到以前的版本吗?
最佳答案
您需要enable force push然后用力推。
为此,在进行重置(删除更改)后:
Enable push --force
然后点击 Update
按钮。 Push
Yes
. Warning
Usually you need to revert changes which simply means undo changes and commit this undo as well. So you have both the change and the undo commit in history.
But sometimes for some reason, you want to get rid of few last commits without having them in remote history (WARNING). So you can reset those few commits and delete changes. Now your local branch is behind the remote branch and there are several incoming commits. Then you can do a force push to overwrite remote commit history by your local history.
Do this carefully, just when you understand what you are doing, is overwriting remote history. Don't do it on a branch which is shared between multiple people.
关于.net - 在 Visual Studio 中执行 git Reset 后如何摆脱传入的提交? (删除远程提交),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45295374/