A s*_*vas 4 git git-rebase git-squash
我尝试了多种方法来压缩远程回购提交,但未正确完成。我要把它们全部压扁,然后做成一个。以下是提交列表。以下是我向上游的拉取请求的摘要(列出了7个提交)。我只想列出一个而不是7。
Cod*_*ard 11
另一种方法是使用squash- i 其他工作interactive rebase
要执行 git squash,请按照以下步骤操作:
# X is the number of commits you wish to squash, in your case 7
# In this interactive rebase there can be more that 7 commits if
# there was a merge in one of them
git rebase -i HEAD~X
Run Code Online (Sandbox Code Playgroud)
压缩提交后 - 选择sfor squash = 它将所有提交合并为一个提交。
git reset --soft HEAD~7
git add --all
git commit
git push --force
Run Code Online (Sandbox Code Playgroud)
首先,将git index重置为要压扁的提交之前。使用--softgit只重置索引而不接触您的工作目录。然后像往常一样创建一个提交。
| 归档时间: |
|
| 查看次数: |
2936 次 |
| 最近记录: |