使用时缩短引用:git log --graph --pretty = oneline --decorate = full --online

时间:2014-06-11 23:56:51

标签: git

我正在使用

git log --graph --pretty=oneline --decorate=full --oneline

获取以下提交图:

  

* 221b95b(HEAD,refs / remotes / origin / master,refs / remotes / origin / HEAD,refs / remotes / upstream / master,refs / heads / master)格式化提交

但显示完整的refs路径是不方便的,因为它太长了。 有没有办法缩短它以缩短路径如下?:

  

* 221b95b(HEAD,origin / master,origin / HEAD,upstream / master,master)格式化提交

2 个答案:

答案 0 :(得分:1)

使用--decorate(默认为short)而不是--decorated=full

--pretty=oneline也是多余的,因为您已使用--oneline,这是--pretty=oneline --abbrev-commit的简写。

最终,只做

git log --graph --decorate --oneline

结果:

* 73017eb (HEAD, origin/master, master) A commit message

答案 1 :(得分:0)

只需使用--decorate代替--decorate=full,因为short--decorate的默认值,如git log documentation中所述(大胆强调我的):

--decorate[=short|full|no]
     

打印出所有提交的引用名称。如果指定了short,则不会打印引用名称前缀refs/heads/refs/tags/refs/remotes/。如果指定了full,则将打印完整的引用名称(包括前缀)。 默认选项为 short

此外,由于jthill commented--pretty=oneline是多余的,因为--oneline已经在每行列出了提交:

  

--oneline表示--pretty=oneline --abbrev-commit

所以把它们放在一起:

git log --graph --decorate --oneline
相关问题