如何使隐藏线的其余部分转移到git log --graph输出中的新行?

问题描述 投票:0回答:1

在.gitconfig中我有这个别名:

[alias]
    ...
    ...
    ...
    lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative

所以我得到的结果如下:

$ g gl1 -12

* 1b9f1d0 - (20 hours ago) recreated (again) for pyton 2.7 and some new features in DB. - xiaose (xiaose-site)
* 409f299 - (5 months ago) changed internal structure. Start frontend design. - xiaose
* ff0ede9 - (5 months ago) Trying to implement new design. Everything starts from beginning. - xiaose
| * 97c9f4e - (7 months ago) Changed PNG beam to SVG and added 2 states in "Symbol" as normal & small symbols. - xiaose (xiaose-predator)
| * c97b838 - (7 months ago) Top level QML which send signal about increment value every second. - xiaose
| * d5859ee - (7 months ago) Symbol definition. There is JS file with actions for increasing & set up some number in symbol. That symbol can show numbers from 0 to 511. - xiaose
| * 1e850e7 - (7 months ago) Beam definition. In one symbol used 9 beams. 5 at the top + 4 at the bottom. - xiaose
| * 92cc1d2 - (7 months ago) There will be QML counter in Predator's style. - xiaose
|/  
* fcd26c9 - (7 months ago) Initial commit. There are my own project for future impl. in productin. - xiaose (xiaose)
| * c2561c3 - (5 days ago) GT1. Fixed issue when hash checking got error & totals in order was 0. - xiaose (gt1)
| * 7dab789 - (5 days ago) GT1. Fixing issue in PP responce. - Justin Felisco
| | * d56e7fa - (5 days ago) GT1. Changes in PayPal. - Justin Felisco (grx1)

一切看起来都不错但是对于小终端窗口,我得到的结果如下:

$ g gl1 -12

* 1b9f1d0 - (20 hours ago) recreated (again) for pyton 2.7 and some new feat    
* 409f299 - (5 months ago) changed internal structure. Start frontend design    
* ff0ede9 - (5 months ago) Trying to implement new design. Everything starts    
| * 97c9f4e - (7 months ago) Changed PNG beam to SVG and added 2 states in "   
| * c97b838 - (7 months ago) Top level QML which send signal about increment   
| * d5859ee - (7 months ago) Symbol definition. There is JS file with action   
| * 1e850e7 - (7 months ago) Beam definition. In one symbol used 9 beams. 5    
| * 92cc1d2 - (7 months ago) There will be QML counter in Predator's style.    
|/  
* fcd26c9 - (7 months ago) Initial commit. There are my own project for futu   
| * c2561c3 - (5 days ago) GT1. Fixed issue when hash checking got error & t   
| * 7dab789 - (5 days ago) GT1. Fixing issue in PP responce. - Justin Felisc   
| | * d56e7fa - (5 days ago) GT1. Changes in PayPal. - Justin Felisco (grx1)   

所以我的问题是:是否可以做smth。字符串分开,其余的转移到新的行?

存在一种方式(如在评论中所述)将字符串换行为:

$ git lg1 -9 | fold -s -w 70

* 1b9f1d0 - (22 hours ago) recreated (again) 
for pyton 2.7 and some new features. - xiaose 
(xiaose-site)
* 409f299 - (5 months ago) changed internal 
structure. Start frontend design. - xiaose
* ff0ede9 - (5 months ago) Trying to implement new design. 
Everything starts from beginning - xiaose
| * 97c9f4e - (7 months ago) Changed PNG 
beam to SVG and added 2 states in "Symbol" as normal & small 
symbols. - xiaose (xiaose-predator)
| * c97b838 - (7 months ago) Top level QML 
which send signal about increment value every second. - 
xiaose
| * d5859ee - (7 months ago) Symbol 
definition. There is JS file with actions for increasing & set up 
some number in symbol. That symbol can show numbers from 0 to 511. 
- xiaose
| * 1e850e7 - (7 months ago) Beam 
definition. In one symbol used 9 beams. 5 at the top + 4 at the 
bottom. - xiaose
| * 92cc1d2 - (7 months ago) There will be 
QML counter in Predator's style. - xiaose
|/  
* fcd26c9 - (7 months ago) Initial commit. 
there will be all my projects. - xiaose 
(xiaose)

但看起来不太好......看起来很乱。

可能你知道有可能做smth。像这样:

* 1b9f1d0 - (22 hours ago) recreated (again) for pyton 2.7 and some 
|           new features. - xiaose (xiaose-site)
* 409f299 - (5 months ago) changed internal structure. Start frontend 
|           design. - xiaose
* ff0ede9 - (5 months ago) Trying to implement new design. 
| |         Everything starts from beginning - xiaose
| * 97c9f4e - (7 months ago) Changed PNG 
| |           beam to SVG and added 2 states in "Symbol" as normal &  
| |           small symbols. - xiaose (xiaose-predator)
| * c97b838 - (7 months ago) Top level QML 
| |           which send signal about increment value every second. - 
| |           xiaose
| * d5859ee - (7 months ago) Symbol 
| |           definition. There is JS file with actions for increasing 
| |           & set up some number in symbol. That symbol can show 
| |           numbers from 0 to 511. - xiaose
| * 1e850e7 - (7 months ago) Beam definition. In one symbol used 9 
| |           beams. 5 at the top + 4 at the bottom. - xiaose
| * 92cc1d2 - (7 months ago) There will be QML counter in Predator's 
| |           style. - xiaose
|/  
* fcd26c9 - (7 months ago) Initial commit. there will be all my 
            projects. - xiaose (xiaose)
git graph terminal
1个回答
1
投票

你可以尝试fold,如果你的发行版有它。例如。:

git lg1 | fold -s -w 40

将在空格处(不在单词的中间)中断并调整为40个字符的宽度。但不确定它与所有变色代码的搭配程度如何。

© www.soinside.com 2019 - 2024. All rights reserved.