Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Let Git variety of colors and custom log format output     - How to use the TF / SD card making Exynos 4412 u-boot boot disk in Ubuntu (Linux)

- Four IDS intrusion detection tool under Linux environment (Linux)

- How to use the Linux terminal Git commands (Linux)

- Understanding Linux firewall Iptables (Linux)

- Oracle11g Trigger Debugging Record Error: PLS-00201: identifier SYS.DBMS_SYSTEM 'must be declared (Database)

- Ubuntu install Wireshark (Linux)

- Management Linux Container with Docker in Ubuntu (Linux)

- Use the dd command to the hard disk I / O performance test (Linux)

- OpenVPN offsite interconnecting room availability and load balancing solution (Server)

- Whisker Menu 1.4.3 Install menu Linux (Linux)

- Linux System Getting Started Learning: Linux in the last command (Linux)

- Ubuntu dual-card system configuration method (Server)

- Ubuntu 10.10 install Oracle 10g graphic tutorials (Database)

- Linux based exercises, interview questions (Linux)

- How to fix Not Enough Free Disk Space On / boot on Ubuntu (Linux)

- To install and use Docker under linux (Server)

- How to use the internal network IP forwarding to connect to the Internet on Linux (Linux)

- Installation and Configuration Munin monitoring server on Linux (Server)

- Ubuntu 14.04 solved using MyEclipse 10.7 flash back (Linux)

- Shell Common Command Summary (Programming)

  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>]]])
- Use the command line MySQL database backup and recovery (Database)
- In Debian 4.3 compiler under Linux-2.6.28 kernel Summary (Programming)
- Linux Network Programming --IP packet format Detailed (Programming)
- Build Eclipse + Maven + Scala-IDEA the Scala Web development environment (Server)
- The REVERSE function of DB2 (Database)
- Git Installation and Configuration (Network Agent settings) (Linux)
- Linux Mint 17.2 64 bit installation Docker and management software seagull (Linux)
- Use Ganglia to monitor your cluster (Server)
- Hive start being given: Found class jline.Terminal, but interface was expected (Database)
- command-line tool for send e-mail (Linux)
- KVM add virtual disks (Linux)
- Talk about the Linux ABI compatibility Application (Linux)
- Linux network monitoring strategy (Linux)
- Java look and feel mode (Facade mode) (Programming)
- Ubuntu install snmp packets Unlinked OID in IPATM-IPMC-MIB: marsMIB (Linux)
- Based kubernetes Construction Docker Cluster Management Comments (Server)
- C # Future: Method Contract (Programming)
- Three kinds of binary tree traversal recursive and iterative solution (Programming)
- Java interview questions in nine radio (Programming)
- Nginx DHCP TFTP Kickstart set up automatic installation system (Server)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.