5 ms·
This command doesn't work on my ubuntu 12.04 system, but I'm not quite familiar enough with bash regular expressions to see exactly where it's getting off track
by japhyr 13y ago
This command doesn't work on my ubuntu 12.04 system, but I'm not quite familiar enough with bash regular expressions to see exactly where it's getting off track. The following expression starts to work for me:
history | grep -o "git [a-Z]" | sort | uniq -c
I get:
42 git a
9 git b
236 git c
8 git d
2 git l
13 git m
82 git p
3 git r
244 git s
If I try
history | grep -o "git [a-Z]{3}" | sort | uniq -c
I would expect to get all of my 'git add' entries, but I get nothing. Can you see what's going wrong?
- yebyen 13y agoTry egrep (or grep -e) The author probably has grep aliased to egrep
- japhyr 13y agoThanks! The original regex still didn't work, but I used: history | egrep -o "git [a-Z]*" | sort | uniq -c and found: 30 git 42 git add 9 git branch 86 git checkout 150 git commit 8 git diff 2 git log 11 git merge 2 git mergetool 1 git pop 32 git pull 49 git push 1 git remote 2 git rm 1 git satus 6 git stash 2 git statsu 2 git statu 233 git status Apparently "git status" is the one command I have trouble typing. I use "git log" quite often, but I have an alias called gitlog that uses the --pretty=oneline flag.
- kiechu 13y agoHere is the right command: https://gist.github.com/anonymous/9053693 https://gist.github.com/anonymous/9053693
- yebyen 13y agoPretty good, except it misinterprets 'git patch -M -C -C -1' as -M -C -C - 205 git status 163 git log 92 git diff 82 git push 74 git pull 66 git branch 51 git commit -av 46 git checkout 37 git add 24 git branch -a 23 git remote 23 git checkout -b 22 git log -u 21 git commit -v 21 git clone 13 git rebase -i 12 git add -p 10 git rm 8 git branch -d 7 git fetch 5 git stash 5 git push --set 5 git branch -D 4 git reset --hard 4 git rebase --continue 4 git format 3 git init 3 git diff --cached 3 git config --global 2 git rebase --abort 2 git rebase 2 git log --pretty 2 git commit --amend -av 2 git commit --amend 2 git commit --allow 1 git urb 1 git rm --cached 1 git reset 1 git patch -M -C -C - 1 git log -u -w 1 git log -u - 1 git log -a 1 git lo 1 git feth 1 git diff -u -- 1 git diff --help 1 git diff -- 1 git config 1 git commit -va 1 git commit --amend -a 1 git commit 1 git checkout --help 1 git apply
- kiechu 13y agoThe problem was with HN changing the command: https://gist.github.com/anonymous/9053693 https://gist.github.com/anonymous/9053693 Here is the right code.