将我的所有提交合并为一份用于 GitHub 拉取请求 [英] Squash all my commits into one for GitHub pull request

查看:21
本文介绍了将我的所有提交合并为一份用于 GitHub 拉取请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 GitHub 上提出了拉取请求.现在存储库的所有者说要将所有提交压缩为一个.

I made a pull request on GitHub. Now the owner of the repository is saying to squash all the commits into one.

当我输入 git rebase -i 记事本打开时显示以下内容:

When I type git rebase -i Notepad opens with the following content:

noop

# Rebase 0b13622..0b13622 onto 0b13622
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

我在 Google 上进行了搜索,但我不明白该怎么做.

I searched on Google but I do not understand how to do this.

推荐答案

只是一个简单的补充,以帮助其他人寻找此解决方案.您可以传入您想要压缩的先前提交的数量.例如,

Just a simple addition to help someone else looking for this solution. You can pass in the number of previous commits you would like to squash. for example,

git rebase -i HEAD~3 

这将在编辑器中显示最后 3 次提交.

This will bring up the last 3 commits in the editor.

这篇关于将我的所有提交合并为一份用于 GitHub 拉取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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