Cause
, , history .
git
Git , GIT_TRACE
true ( . Git - Scott Chacons Git Book).
$ GIT_TRACE=true git freq
10:14:11.901296 git.c:554 trace: exec: 'git-freq'
10:14:11.901296 run-command.c:341 trace: run_command: 'git-freq'
10:14:11.932496 run-command.c:341 trace: run_command: 'history | tail'
10:14:11.963697 run-command.c:192 trace: exec: '/bin/sh' '-c' 'history | tail' 'history | tail'
, execv_shell_cmd, sane_execvp, -end execvp, - - PATH , . history , , .
, , , - :
Bash , Bash , , exec, . history .
1.
Gilles on Unix Linux , , HISTFILE set -o history, :
bash -c "HISTFILE=~/.bash_history; set -o history; history"
.gitconfig :
freq = "!HISTFILE=$HOME/.bash_history; set -o history; history | cut -c 8- | grep ^git | sort | uniq -c | sort -n -r | head -n 5"
. , Bash, , . Bash, , HISTFILE , $HOME/.bash_history.
, , HISTFILE, ( git), .
2:
:
freq = !grep ^git $HOME/.bash_history | sort | uniq -c | sort -n -r | head -n 5
, history , , , , .
, cut .
3: Bash
- Git Bash:
alias git-freq='history | cut -c 8- | grep ^git | sort | uniq -c | sort -n -r | head -n
, Id . , Bash, .
, , . .bashrc, , :
shopt -s histappend
HISTCONTROL=ignoredups:ignorespace
HISTFILESIZE=5000
HISTSIZE=3000
PROMPT_COMMAND="history -a"