All programs are hosted on github!
awk '!seen[$0]++'
From Jonas Elfström.
My old solution was nl -ba | sort -suk2 | sort -n | cut -f2-
.
Put this in your ~/.bashrc
:
# don't put duplicate lines or lines starting with space in the history
HISTCONTROL=ignoreboth
# everlasting history
HISTFILESIZE=
HISTSIZE=
# immediately append to history after every command, so that history
# is sorted chronologically when using multiple sessions
PROMPT_COMMAND="${PROMPT_COMMAND}${PROMPT_COMMAND:+;}history -a"
# append to the history file, don't overwrite it
shopt -s histappend
mkdir -p ~/.git/hooks
git config --global core.hooksPath '~/.git/hooks'
~/.git/hooks/prepare-commit-msg
:
#!/bin/sh
if [ -z "$2" ] ; then
echo "# Recent relevant commits:" >> "$1"
git diff --cached --name-only -z | xargs -r -0 git log -3 -- | sed -e 's/^/#\t/' -e 's/^#\t$/#/' >> "$1"
fi