0

我有一个 git 远程“我的”(恰好是一个 github 叉子),它已经成功地通过 2 次提交取得了进展。我的本地主分支领先于 244 次提交(从原始 gitub 存储库中提取)。因此,推动“我的”并不是快进的。

如何列出“我的”领先的 2 个提交?

4

1 回答 1

4

您的问题有点不清楚,但听起来您想列出远程分支上尚不存在于本地分支中的提交。这只需使用提交范围即可完成..

# Get the most recent updates from the remote
git fetch <remote>

# List all commits that are in <remote>/<branch> but not in your local <branch>
git log --oneline <branch>..<remote>/<branch>

文档

来自官方 Linux 内核git log文档

<since>..<until>

仅显示指定的两个提交之间的提交。当省略<since><until>省略时,默认为 HEAD,即当前分支的尖端。有关拼写<since>and的更完整列表<until>,请参阅gitrevisions(7)

也可以看看

于 2014-06-12T13:34:25.043 回答