Commands tagged git-log (6)

  • Only show a short of important information inline ( include branch info ), and color this log tree. Show Sample Output


    3
    git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Cblue - %cn %Creset' --abbrev-commit --date=relative
    Brandonccx · 2015-08-12 07:11:15 9
  • Print a git log (in reverse order) giving a reference relative to HEAD. HEAD (the current revision) can also be referred to as HEAD~0 The previous revision is HEAD~1 then HEAD~2 etc. . Add line numbers to the git output, starting at zero: ... | nl -v0 | ... . Insert the string 'HEAD~' before the number using sed: ... | sed 's/^ \+/&HEAD~/' . Thanks to bartonski for the idea :-) Show Sample Output


    2
    git log --oneline | nl -v0 | sed 's/^ \+/&HEAD~/'
    flatcap · 2015-11-23 21:35:57 14
  • Normally, searching git log comments is case sensitive. The -i luckily applies to the --grep switch.


    1
    git log -i --grep='needle'
    sudopeople · 2015-08-11 23:07:55 10

  • 1
    o=0; git log --oneline | while read l; do printf "%+9s %s\n" "HEAD~${o}" "$l"; o=$(($o+1)); done | less
    bartonski · 2015-11-23 17:47:16 11
  • The command outputs the number of commits made to a git repository be leveraging the git-log git command and the wc command that ships with linux coreutil Show Sample Output


    0
    git log --pretty=oneline | wc -l
    lym · 2015-09-25 19:47:26 7
  • This is how you can do this without having to use oneline Show Sample Output


    0
    git log | nl -w9 -v0 --body-numbering='pcommit\ [0-9a-f]\{40\}' | sed 's/^ \+\([0-9]\+\)\s\+/HEAD~\1 /'
    guywithnose · 2015-11-23 21:53:33 10

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Run a bash script in debug mode, show output and save it on a file

recurisvely md5 all files in a tree
Found this little gem here: http://info.michael-simons.eu/2008/10/25/recursively-md5sum-all-files-in-a-directory-tree/

list the top 15 folders by decreasing size in MB
list the top 15 folders by decreasing size in MB

Remove ( color / special / escape / ANSI ) codes, from text, with sed
Remove ( color / special / escape / ANSI ) codes, from text, with sed Credit to the original folks who I've copied this command from. The diff here is: Theirs: [m|K] Theirs is supposed to remove \E[NUMBERS;NUMBERS[m OR K] This statement is incorrect in 2 ways. 1. The letters m and K are two of more than 20+ possible letters that can end these sequences. 2. Inside []'s , OR is already assumed, so they are also looking for sequences ending with | which is not correct. This : [a-zA-Z] This resolves the "OR" issue noted above, and takes care of all sequences, as they all end with a lower or upper cased letter. This ensures 100% of any escape code 'mess' is removed.

tail, with specific pattern colored

Help shell find freshly installed applications (re: PATH)
Immediately after installing things into your PATH (e.g. under /usr/bin), currently open shells cannot find them ("zsh: command not found"). Use rehash to get the shell to rescan available executables.

Make alias pemanent fast
Simple function to permanently add an alias to your profile. Tested on bash and Ksh, bash version above. Here is the ksh version: PERMA () { print "$@" >> ~/.profile; } Sample usage: PERMA alias la='ls -a'

directory size with subdirectories, sorted list

Compare copies of a file with md5
I had the problem that the Md5 Sum of a file changed after copying it to my external disk. This unhandy command helped me to fix the problem.

Display standard information about device
Queries the specified ethernet device for associated driver information


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: