$ git reflog
e5545c33c (HEAD -> main, origin/main, origin/HEAD) HEAD@{0}: rebase (finish): returning to refs/heads/main
e5545c33c (HEAD -> main, origin/main, origin/HEAD) HEAD@{1}: rebase (start): checkout refs/remotes/origin/main
5400c9c85 HEAD@{2}: commit: <redacted>
<... snipped ...>
# we see ^ that my pull performed a rebase. I prefer rebase over merge and am
# not sure how merge would behave in this situation - sorry.
# next, we grab the commit below the rebase:
$ REF=5400c9c85
# count commits between that and HEAD
$ git rev-list --count $REF..
8
3条答案
按热度按时间cedebl8k1#
您可以先执行
git fetch
,然后执行git merge
,而不是执行git pull
。* 在你进行合并之前,git status
会显示你有多少提交“落后”;这是你已经获取的提交数量,假设你在获取之前落后0。aurhwmvo2#
或
请让我知道这些命令是否有帮助
vqlkdk9b3#
如果像我一样,你已经执行了pull,那么
git fetch
之后的git status
的(好)建议对你没有帮助。这似乎起作用: