Git:列出所有远程分支上的所有提交?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7149740/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 11:39:34  来源:igfitidea点击:

Git: list all commits on all remote branches?

git

提问by Hymano

I would like to list all commits on all remote branches in my repository.

我想列出我的存储库中所有远程分支上的所有提交。

I just want the SHA1 for each commit.

我只想要每次提交的 SHA1。

采纳答案by Mark Longair

The following should do what you want:

以下应该做你想做的:

git rev-list --remotes

The documentation for the --remotesoptionsays:

选项文档--remotes说:

--remotes[=<pattern>]

Pretend as if all the refs in refs/remotes are listed on the command line as <commit>. If <pattern> is given, limit remote-tracking branches to ones matching given shell glob. If pattern lacks ?, , or [, / at the end is implied.

--remotes[=<模式>]

假设 refs/remotes 中的所有 refs 都在命令行中列为 <commit>。如果给定 <pattern>,则将远程跟踪分支限制为与给定 shell glob 匹配的分支。如果模式缺少 ?, , 或 [, / 在末尾是隐含的。

As a point of pedantry, these are "remote-tracking branches" rather than "remote branches" - the latter is a somewhat ambiguous term in git, since you might be referring to a branch in remote repository or a remote-tracking branch (which is like a cache of the state of the branch in the remote repository).

作为学究的一点,这些是“远程跟踪分支”而不是“远程分支”——后者在 git 中是一个有点模棱两可的术语,因为您可能指的是远​​程存储库中的分支或远程跟踪分支(其中就像远程存储库中分支状态的缓存)。

回答by SGhosh

Try this -

尝试这个 -

git log --branches=*

git log --branches=*

回答by sehe

Simple:

简单的:

git rev-list --all --remotes

I hope that helps

我希望有帮助

Of course, drop the --all if you justwant to list revisions in remotes (which 90% of the time will overlap those in your local branches)

当然,如果您只想列出远程版本中的修订版本(90% 的时间会与本地分支中的修订版本重叠),请删除 --all

回答by Parmatma

If you want refrences with it use this--

如果你想参考它使用这个 -

git show-ref

回答by Martin Carlsson

For those of you who wants to copy/paste it from a GUI to, say Excel.

对于那些想要从 GUI 复制/粘贴它的人,比如说 Excel。

Sourcetreehas a Historyfunction where you can see every commit from all branches, with description, time and author

Sourcetree有一个History功能,您可以在其中查看来自所有分支的每个提交,以及描述、时间和作者