在 git 中查看完整版本树
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5361019/
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
Viewing full version tree in git
提问by petersohn
I am using the command line version of Git and gitk. I want to see the full version tree, not just the part that is reachable from the currently checked out version. Is it possible?
我正在使用 Git 和 gitk 的命令行版本。我想查看完整的版本树,而不仅仅是从当前签出的版本中可以访问的部分。是否可以?
采纳答案by Mark Longair
You can try the following:
您可以尝试以下操作:
gitk --all
You can tell gitk
what to display using anything that git rev-list
understands, so if you just want a few branches, you can do:
您可以gitk
使用任何可以git rev-list
理解的内容来判断要显示的内容,因此,如果您只需要几个分支,则可以执行以下操作:
gitk master origin/master origin/experiment
... or more exotic things like:
...或更奇特的东西,例如:
gitk --simplify-by-decoration --all
回答by knittl
if you happen to not have a graphical interface available you can also print out the commit graph on the command line:
如果您碰巧没有可用的图形界面,您还可以在命令行上打印出提交图:
git log --oneline --graph --decorate --all
if this command complains with an invalid option --oneline, use:
如果此命令抱怨无效选项 --oneline,请使用:
git log --pretty=oneline --graph --decorate --all
回答by checksum
When I'm in my work place with terminal only, I use:
git log --oneline --graph --color --all --decorate
When the OS support GUI, I use:
gitk --all
When I'm in my home Windows PC, I use my own GitVersionTree
当我在工作场所仅使用终端时,我使用:
git log --oneline --graph --color --all --decorate
当操作系统支持 GUI 时,我使用:
gitk --all
当我在家里的 Windows PC 上时,我使用自己的GitVersionTree
回答by Daniil Shevelev
There is a very good answerto the same question.
Adding following lines to "~/.gitconfig":
同样的问题有一个很好的答案。
将以下行添加到“~/.gitconfig”:
[alias]
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
回答by clarkttfu
Reputation not enough to comment on knittl's answer, so:
声誉不足以评论 knittl 的回答,所以:
If you don't need branch or tag name:git log --oneline --graph --all --no-decorate
如果您不需要分支或标签名称:git log --oneline --graph --all --no-decorate
If you don't even need color (to avoid the key sequence when piped out):git log --oneline --graph --all --no-decorate --no-color
如果您甚至不需要颜色(以避免管道输出时的按键顺序):git log --oneline --graph --all --no-decorate --no-color
You might want to use alias (in .gitconfig) to make life easier:
你可能想使用别名(在 .gitconfig 中)来让生活更轻松:
[alias]
tree = log --oneline --graph --all --no-decorate
Only last option takes effect, so it's even possible to override your alias:git tree --decorate
只有最后一个选项生效,所以甚至可以覆盖你的别名:git tree --decorate