git 删除 SourceTree 中的等待推送

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30423775/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:03:02  来源:igfitidea点击:

Remove waiting push in SourceTree

gitpushcommitatlassian-sourcetree

提问by clankill3r

I committed files that I don't want to push. I didn't push yet.

我提交了不想推送的文件。我还没推。

How can I remove the commit?

如何删除提交?

This is how my screen looks:

这是我的屏幕外观:

change list

更改列表

These are the options:

这些是选项:

options

选项

I don't want to undo any changes to the source code!

我不想撤消对源代码的任何更改!

回答by BJ Myers

To remove the commit without changing any source code, you need to perform a "mixed" reset.

要在不更改任何源代码的情况下删除提交,您需要执行“混合”重置。

Right click on the last "good" commit (this will probably be origin/master). Select "Reset current branch to this commit."

右键单击最后一个“好的”提交(这可能是origin/master)。选择“将当前分支重置为此提交”。

Reset current branch to this commit

将当前分支重置为此提交

In the resulting dialog, select "Mixed..." from the drop down and click OK.

在出现的对话框中,从下拉列表中选择“混合...”,然后单击“确定”。

Mixed

混合

Your working copy will remain the same (no files will be changed) but the index will be reset, meaning that all commits afterthe selected one will be removed from your history.

您的工作副本将保持不变(不会更改任何文件),但索引将被重置,这意味着所选副本之后的所有提交都将从您的历史记录中删除。