[英]What is the git commands to delete unwanted commits that haven't been pushed to the remote?
If I have a few local topic branches I have made commits on and haven't yet pushed them to the remote, how can I delete them? 如果我有几个本地主题分支,我已经提交但还没有将它们推送到远程,如何删除它们?
I don't want to pollute the main tree with unwanted commits. 我不想用不需要的提交来污染主树。
If you haven't yet pushed them to the remote, it should be easy to delete them. 如果您尚未将它们推送到遥控器,则应该很容易删除它们。
git branch -D <branch-to-delete>
will forcibly delete a branch that you don't want to keep. 会强行删除您不想保留的分支。
尝试查找变基-这里有很多视频: http : //www.ava.co.uk/git
Try this one. 试试这个。 This way it's possible to drop single commit.
这样就可以删除单个提交。 I assume the commit you want to drop is no further than 16 steps back from the HEAD.
我假设您要删除的提交距离HEAD不超过16步。
git rebase -i HEAD~16...HEAD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.