如何从git pull请求中排除提交? [英] How to exclude a commit from git pull request?

查看:162
本文介绍了如何从git pull请求中排除提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用我的仓库发出了git pull请求.一段时间之后,在请求请求获得批准之前,我继续进行另一个提交和推送,该请求也被推送到请求请求.

I have made a git pull request with my repo. Sometime later, before pull request got approved, I proceeded to make another commit&push which also got pushed up to pull request.

是否有一种方法可以删除请求请求中的最后一个提交,以及如何防止将来发生这种情况?

Is there a way to remove the last commit from pull request and how to prevent this from happening in the future?

推荐答案

是的,您只需将分支重置为先前的提交,然后强制推送:提取请求将自动更新.

Yes, you simply can reset your branch to the previous commit, and force push: the pull request will be automatically updated.

git checkout yourBranch
git reset --hard yourBranch~
git push --force origin yourBranch

然后,如果您想使这种错误更加严重,请在本地删除您的分支机构:您不会检出它或错误地使用它.

Then, if you want to make such an error harder, delete your branch locally: you won't checkout it or use it by mistake.

这篇关于如何从git pull请求中排除提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆