如何从PR中删除某些提交?

时间:2019-07-08 21:21:49

标签: git bitbucket

我未提交通过进行git reset --hard feature/DCMP-959推送到PR的某些提交。

然后我做了一些小的更改,并以正确的消息提交了它,但是当我将其推送到PR时,它重新推送了我先前删除的未提交的提交:

enter image description here

如何从PR中完全消除提交388be463463和提交6b3a92b79bb并留下最新的提交?

我需要消除这些提交,因为我收到以下错误消息:

  

JQL检查由于一个或多个引用的JIRA,因此无法合并此PR   问题不在于:a)与该项目有关; b)允许的问题   类型; c)处于允许状态;或d)分配了修订版本和/或   父修补程序版本

我的构建失败。

1 个答案:

答案 0 :(得分:0)

如果您要对分支feature/DCMP-959中的更改进行1次提交,然后将其合并到master中,那么:

git checkout feature/DCMP-959
git merge origin/master
# keep all the files as they are in working dir, but remove all commits
git reset --soft origin/master
git commit -m 'Nice looking message'
# will re-write the commits in your remote branch
git push -f origin HEAD:refs/heads/feature/DCMP-959

如果您只想删除(压扁)某些提交,则每次提交都需要手动使用git rebase -i或cherry-pick / squash。

相关问题