将我的所有提交压缩成一个用于GitHub拉取请求 [英] Squash all my commits into one for GitHub pull request

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

问题描述

我在GitHub上做了一个pull请求。现在仓库的所有者正在说要将所有提交压缩成一个。

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天全站免登陆