Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off color and remove the time in Git log?

Tags:

git

As mentioned in the title, how to turn off color and remove the time?

Because I need to copy the output to pbcopy, but the color mode will make the output contain special characters.

like image 937
user3675188 Avatar asked Dec 31 '14 14:12

user3675188


2 Answers

I’ve added the following to the ~/.gitconfig file, in order to remove most of the color:

[color]        
    ui = false
    branch = false
    diff = false
    interactive = false
    status = false
    log = false

(Note: I’m running git-bash from MINGW64 on Windows 10.)

like image 172
theRiley Avatar answered Oct 01 '22 14:10

theRiley


If you don't want to disable colors for all commands, you can at least disable it just for the current log command:

git log --stat --no-color

Regarding the time, what you see is not the usual log output. Check if you have defined any alias for git log.

Note: as mentioned in "Copy Shell Output via the Command Line", an easy way to copy to pbcopy is to pipe to it:

pbcopy and clip. Using pbcopy within the shell, the output of an execution can automatically be added to the copy queue (or clipboard).
Piping pbcopy at the end of the command makes this magic possible.

git log --stat --no-color | pbcopy
like image 36
VonC Avatar answered Oct 01 '22 15:10

VonC