Git 正常挤压指令未显示预期提交

Git 正常挤压指令未显示预期提交,git,squash,Git,Squash,我有挤压的问题。我已经复习了类似的问题,但它们似乎不合适 当我执行git状态时,我得到: Your branch is ahead of 'origin/mutual_19.2.1' by 2 commits. 当我执行git log时,它会显示: commit 9be1847ec8d9b472f99e362b266ec18fc73470dd Merge: 67eb216 5bee872 Author: jsmith <john.smith@acme.com> Date: Fr

我有挤压的问题。我已经复习了类似的问题,但它们似乎不合适

当我执行git状态时,我得到:

Your branch is ahead of 'origin/mutual_19.2.1' by 2 commits.
当我执行
git log
时,它会显示:

commit 9be1847ec8d9b472f99e362b266ec18fc73470dd
Merge: 67eb216 5bee872
Author: jsmith <john.smith@acme.com>
Date:   Fri Feb 15 12:57:21 2019 -0500

Merge branch 'mutual_19.2.1' of ssh://cm1.mutual.us.vector.com:29418/Data_Delivery into Ticket_7503

Change-Id: I8d39d66d9d7a3933cb49bfc7f114e460aa141b5c

commit 67eb216fee18aecf6458a84bf9863901336b10a8
Author: jsmith <john.smith@acme.com>
Date:   Fri Jan 4 09:53:15 2019 -0500

Mutual #7503 - Remove subscription grouping capabilities.

Change-Id: I8d39d66d9d7a3933cb49bfc7f114e460aa141b5c
然而,这让我明白了

pick 67eb216 Mutual #7503 - Remove subscription grouping capabilities.
pick 0749a12 Mutual #7330 - Made latency for PDA subscriptions editable.
pick 0ab8c6e Mutual #7504 - Close Subset dialog on subscription creation.
这几乎与上述完全不同


这是什么原因造成的?我如何压缩我要压缩的提交?

这是因为您的分支/分支未与主/上游同步

如果您正在使用叉子:

git fetch upstream
git rebase upstream/develop or git rebase upstream/master (which ever is the branch for which you want to make a pull request) 
git push origin <your-branch-name> -f
git获取上游
git-rebase-upstream/develop或git-rebase-upstream/master(您希望为哪个分支发出请求)
git推送原点-f
如果您正在处理同一存储库中的分支:

git fetch origin
git rebase origin/develop or git rebase origin/master (which ever is the branch for which you want to make a pull request) 
git push origin <your-branch-name> -f 
git获取来源
git-rebase-origin/develope或git-rebase-origin/master(您希望为其发出拉取请求的分支)
git推送原点-f

然后执行git日志,然后执行git rebase-i HEAD~2

最上面的提交是合并提交,因此有两个父级。因此,
HEAD~2
将在交互式基础中解析为2次提交。
git-rebase
默认情况下忽略合并,合并“应”仅应用其父级中已发生的更改,任何冲突解决方案可能不适用于新基础。这三次提交不在
HEAD~2
的历史记录中,而是在
HEAD
中。您不需要提供计数,rebase默认为上游,您的命令只是
git-rebase
。如果你真的只想挤压所有东西,那么就执行git reset--hard@{u};git merge--squash@{1}。
git fetch origin
git rebase origin/develop or git rebase origin/master (which ever is the branch for which you want to make a pull request) 
git push origin <your-branch-name> -f