首页 > 解决方案 > Github Open Pull Requests

问题描述

I'd like to ask a question regarding Github, specifically pull requests.

Let's say for example that there is an open pull request.

I made a commit 'feat: add feature', and then a little while later someone else made a couple more commits to the pull request, 'feat: add feature b' and 'feat: add feature c', if I wanted to rename my original commit, is there a way to do that?

If I simply did something like git reset HEAD~, would that ruin the two commits made after mine?

Thanks!

标签: gitgithubcommitpull-request

解决方案


您可以通过 重命名第一个提交interactive rebasing

如果头部有 3 个提交,请使用此命令 git rebase -i HEAD~3

这将打开这样的东西

pick a1beca Your commit
pick a2beca feat: add feature b
pick a3beca feat: add feature c

...

点击键盘上的“i”以激活交互模式。改写你的提交

reword a1beca Your commit
pick a2beca feat: add feature b
pick a3beca feat: add feature c

...

点击“esc”退出交互模式。然后:wq这将要求您输入所需的提交消息。

欲了解更多信息,请阅读此处。一些练习会带你到那里。


推荐阅读