删除第一个 git commit
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3430792/
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
delete first git commit
提问by atomical
I made a mistake when I first committed. I'm on another person's computer and pushed a version with their user.name instead of mine. How can I delete this?
我第一次犯错时犯了错误。我在另一个人的计算机上并使用他们的用户名而不是我的用户名推送了一个版本。我怎样才能删除这个?
采纳答案by cmcginty
There are a lot of duplicate questions related to this. The following is a generic solution for replacing the first commit of your tree. After you perform this step, you can make any other changes using git rebase -i
.
有很多与此相关的重复问题。以下是替换树的第一次提交的通用解决方案。执行此步骤后,您可以使用 进行任何其他更改git rebase -i
。
回答by Olaf Muller
You can just force-push a repository containing the initial commit you want to Github using git push --force
.
您可以使用git push --force
.