Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Let Git variety of colors and custom log format output     - Spark SQL job of a lifetime (Server)

- HTTP and HTTPS request response process difference (Linux)

- C ++ Supplements --new delete overload (Programming)

- A detailed introduction to the Hadoop ecosystem (Server)

- Using the Android interface in Parcelable (Programming)

- Nginx + uWSGI + Django + Python Application Architecture Deployment (Server)

- Linux Command Study Notes (Linux)

- Detailed PHP code optimization [section] (explain reasons) (Programming)

- CentOS 6.7 compile and install LAMP (Server)

- How to install Linux Go Language (Linux)

- LNMP Note: Addressing mail function can not send mail (Server)

- Why learn Java EE (Programming)

- Redhat 7 modify the default run level method --RHEL7 use systemd to create a symbolic link to the default runlevel (Linux)

- CentOS 6.5_x64 install Oracle 11g R2 (Database)

- To compile and install OpenCV-2.3.1 FFmpeg-2.1.2 under CentOS (Linux)

- After the first remote installation GlassFish Web to remotely access their back office management system error solution appears (Server)

- Android Scroller call mechanism and the relationship of computeScroll (Programming)

- Django1.5 Custom User Model (Programming)

- Oracle to read and modify the data block process (Database)

- Nginx + ownCloud + PHP + MySQL to build personal private cloud under CentOS7 (Server)

  Let Git variety of colors and custom log format output
  Add Date : 2016-09-17      
  Git multi-color output

Git default output is a single color, not only not beautiful, not easy to read. In fact, Git support itself in a variety of colors to display the information on its output, simply run the following command at the command line to modify the git setup, you can open multiple color output:

git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
After executing the above command, git's status, diff command and branch and so on are all output with the color.

Custom log format

After completing the above steps, git log command output, although with a little color, but still seems boring ..

It does not matter, the powerful git provides custom log format features, try entering the following command:

git log --graph --pretty = format: '% Cred% h% Creset -% C (yellow)% d% Creset% s% Cgreen (% cr)% C (bold blue) <% an>% Creset' - -abbrev-commit

How, not bad, right? However, each time you view log output so are a long list of commands, it is not realistic. Let's solve this problem by git command aliases. Enter the following command:

git config --global alias.lg "log --graph --pretty = format: '% Cred% h% Creset -% C (yellow)% d% Creset% s% Cgreen (% cr)% C (bold blue) <% an>% Creset ' "
The above command will create a command alias lg, every time you use the command git lg equivalent to just enter the long list of commands. Now, if you want to see beautiful multi-color output, use git lg, if you want to see the normal log output, use git log, the two non-interfering.

If you want to log the output of certain information, you can adjust their value --pretty parameters, for example, the following command will display only commit the hash, commit time, the author's name:

git log --pretty = format: '% h% ar% an'
The format back single quotes replaces the format you want, you can implement custom log output format. Here% h,% ar, etc. are some of the git predefined placeholder for a complete list is as follows:

% H commit hash
Short hash% h commit the
% T tree hash
Short hash% t tree of
% P parent hashes
Short hashes% p parent of
% An Author name
% AN mailmap corresponding name of the author (.mailmap correspondence, details refer git-shortlog (1) or git-blame (1))
% Ae OF mailbox
% AE OF mailbox (.mailmap correspondence, details refer git-shortlog (1) or git-blame (1))
% Ad date (-date = format developed)
% AD date, RFC2822 format
% Ar date relative format (1 day ago)
% At the date, UNIX timestamp
% Ai dates, ISO 8601 format
% Cn submitter name
% CN submitter name (.mailmap correspondence, details refer git-shortlog (1) or git-blame (1))
% Ce Submitted by email
% CE submitted by email (.mailmap correspondence, details refer git-shortlog (1) or git-blame (1))
% Cd filing date (-date = format developed)
% CD submission date, RFC2822 format
% Cr submission date and relative format (1 day ago)
% Ct submission date, UNIX timestamp
% Ci submission date, ISO 8601 format
% D ref name
% E encoding
% S commit Title
% F filter commit information to make the title as the file name
% B commit content
% N commit notes
% GD reflog selector, e.g., refs / stash @ {1}
% Gd shortened reflog selector, e.g., stash @ {1}
% Gs reflog subject
% Cred switch to red
% Cgreen switch to green
% Cblue switch to blue
% Creset Reset color
% C (...) to develop color, as described in color.branch. * Config option
% M left, right or boundary mark
% N newline
%% A raw%
% X00 print a byte from a hex code
% W ([< w> [, < i1> [, < i2>]]])
- CentOS6 5 Configure SSH password Free (Linux)
- Postmodern systems programming language (Programming)
- Linux Security Module (LSM) Introduction (Linux)
- MySQL multi-instance configuration (Database)
- HTTPS and SSH and use the difference between the way: Git User's Manual (Linux)
- ActiveMQ5.10.2 version configuration JMX (Linux)
- Some problems and countermeasures Linux system calls exist (Linux)
- Haproxy multi-domain certificate HTTPS (Server)
- ASM Management - How to Rename diskgroup (Database)
- How to interactively create a Docker container (Server)
- Android Fragment everything you need to know (Programming)
- Delete specific files using bash directory under Linux (Linux)
- ImageMagick Tutorial: How to cut images in Linux command line (Linux)
- High-performance Linux system firewall detailed analysis of double-effect (Linux)
- Java reflection Introduction (Programming)
- Transfer files and permissions from Windows to Linux system by Samba (Linux)
- Getting Started with Linux system to learn: How do I know which processes are running on the CPU core (Linux)
- HashMap in Android and Java different implementations (Programming)
- How MAT Android application memory leak analysis (Programming)
- GAMIT 10.50 installed in Ubuntu 12.04 system (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.