
Ask HN: Which git commands do you use most? (counting command included) - kiechu
Here is command that counts them:<p>&#x2F;&#x2F; Updated. HN filters changed the line, so see the code via Gist:
https:&#x2F;&#x2F;gist.github.com&#x2F;anonymous&#x2F;9053693<p>Here are my results:<p><pre><code>     49 git status -s
     15 git commit -am
     12 git push
     11 git checkout
     10 git add
      7 git branch
      5 git rm
      5 git mv
      5 git diff
      3 git rm --cached
      3 git rebase
      3 git commit -m
      3 git checkout -b
      2 git rm -r --cached
      2 git clone
      2 git branch -v
      1 git status -ss
      1 git status
      1 git satus -s
      1 git rm --chached
      1 git reset --soft
      1 git reset --hard
      1 git reflog
      1 git rebase --skip
      1 git rebase --continue
      1 git push --set
      1 git log
      1 git diff --cached
      1 git branch --remote
      1 git branch -d
      1 git barnch
      1 git add -u
      1 git add --all
</code></pre>
What are yours?
======
twiss

         $ history -w /dev/stdout | grep -o "^git [a-Z]*\( -\{1,2\}\([a-Z]\)*\)*" | sort | uniq -c | sort -rg
         39 git status
         26 git checkout
         24 git diff
         23 git log -
         11 git stash
         10 git add
          9 git cherry
          7 git reset
          7 git merge
          7 git commit
          6 git commit -m
          4 git help
          4 git grep
          3 git show
          3 git reset --hard
          3 git remote
          3 git rebase -i
          3 git diff --cached
          3 git checkout -b
          2 git log
          2 git checkout --
          2 git branch
          2 git add -p
          1 git stash --list
          1 git rebase -p --onto
          1 git rebase --continue
          1 git rebase --abort
          1 git rebase
          1 git push
          1 git diff --sta
          1 git diff -p -n
          1 git diff -p -l -n
          1 git diff -p -l -e
          1 git diff -ple
          1 git commit --amend
          1 git commit -am
          1 git clone --recursive
          1 git clone
          1 git blame
          1 git add --interactive
    

Some of this is quite amusing to me ("git help", "git rebase --abort", me
trying to get a readable diff near the bottom) -- I'm a git novice. Btw, "git
log -" near the top means git log -2, -3, -8, for example.

------
milkers
I am new to git and using it for my humble projects.

    
    
         79 git add
         66 git commit -a -m
         58 git push
         32 git pull
          6 git remote
          6 git init
          6 git clone
          4 git reset
          3 git push -u
          2 git pull --force
          2 git merge
          2 git commit -a
          1 git status
          1 git rm
          1 git rebase
          1 git fetch
          1 git comit -a -m
          1 git

------
cowpewter

      79 git pull
      74 git checkout
      61 git status
      50 git log
      38 git push
      26 git diff
      20 git show -p
      15 git commit --amend
      14 git add -A
      13 git show
      13 git commit -am
      12 git checkout -b
      11 git branch -D
       7 git cherry -v
       7 git blame
       5 git cp
       4 git stash
       4 git reset --hard
       4 git commit -m
       3 git rebase
       3 git merge
       3 git checkout --
       3 git branch -d
       3 git branch --set
       3 git add -u
       2 git tag
       2 git rebase --continue
       2 git cherry
       2 git add -a
       2 git add
       1 git staus
       1 git statu
       1 git rebase -i
       1 git commit -a
       1 git commit --ammend
       1 git branch -set
       1 git 
    

cp is a git alias I have for cherry-pick. Pretty sure the 'git branch -set' is
supposed to be 'git branch -set-upstream-to'

I use different terminal tabs for each repo, so this is just one of the repos
I use at work.

------
japhyr
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
Try egrep (or grep -e)

The author probably has grep aliased to egrep

~~~
kiechu
Here is the right command:
[https://gist.github.com/anonymous/9053693](https://gist.github.com/anonymous/9053693)

~~~
yebyen
Pretty 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

------
micah_chatt
If you're using OS X, instead of using [a-Z], try [a-zA-Z].

~~~
lutusp
Hmm. Is \w still an extension, not universally supported?

------
AznHisoka
git commit -a git push git diff

I usually work by myself, so rarely use git pull :)

