TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Which git commands do you use most? (counting command included)

13 pointsby kiechuover 11 years ago
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?

6 comments

twissover 11 years ago
<p><pre><code> $ history -w &#x2F;dev&#x2F;stdout | grep -o &quot;^git [a-Z]*\( -\{1,2\}\([a-Z]\)*\)*&quot; | 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 </code></pre> Some of this is quite amusing to me (&quot;git help&quot;, &quot;git rebase --abort&quot;, me trying to get a readable diff near the bottom) -- I&#x27;m a git novice. Btw, &quot;git log -&quot; near the top means git log -2, -3, -8, for example.
milkersover 11 years ago
I am new to git and using it for my humble projects.<p><pre><code> 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</code></pre>
cowpewterover 11 years ago
<p><pre><code> 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 </code></pre> cp is a git alias I have for cherry-pick. Pretty sure the &#x27;git branch -set&#x27; is supposed to be &#x27;git branch -set-upstream-to&#x27;<p>I use different terminal tabs for each repo, so this is just one of the repos I use at work.
japhyrover 11 years ago
This command doesn&#x27;t work on my ubuntu 12.04 system, but I&#x27;m not quite familiar enough with bash regular expressions to see exactly where it&#x27;s getting off track. The following expression starts to work for me:<p><pre><code> history | grep -o &quot;git [a-Z]&quot; | sort | uniq -c </code></pre> I get:<p><pre><code> 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 </code></pre> If I try<p><pre><code> history | grep -o &quot;git [a-Z]{3}&quot; | sort | uniq -c </code></pre> I would expect to get all of my &#x27;git add&#x27; entries, but I get nothing. Can you see what&#x27;s going wrong?
评论 #7252741 未加载
评论 #7252495 未加载
micah_chattover 11 years ago
If you&#x27;re using OS X, instead of using [a-Z], try [a-zA-Z].
评论 #7253459 未加载
AznHisokaabout 11 years ago
git commit -a git push git diff<p>I usually work by myself, so rarely use git pull :)