2010年11月29日 星期一

我的git使用經驗

我在一個新的sdk中自已用了git來測驗
我發現git-status有時候很慢,查了一下,有人說用git-gc來加快access
於是我下了git-gc,等了幾分鐘後還是沒run完,一看memroy,竟被吃光了:

peter$ git-gc
Counting objects: 88839, done.

Compressing objects:  18% (15328/84733)
後來改用
git-diff --stat就快多了

petert$ git diff --stat drivers/
 .../hal/linux/public/mipsisa32-be-elf.opt_ah.h     |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
git-status用git-commit同樣的options, 主要是用來比較git-commit時會發生那些變動
git-status其實就是git-commit --preview, 見意採用git-diff --stat…
http://stackoverflow.com/questions/715321/git-status-is-there-a-way-to-show-changes-only-in-a-specific-directory

The reason that git status takes the same options as git commit is that the purpose of git status is to show what would happen if you committed with the same options as you passed to git status. In this respect git status is really git commit --preview.
To get what you want, you could do this which shows staged changes:
git diff --stat --cached -- 
and this, which shows unstaged changes:
git diff --stat -- 
or this which shows both:
git diff --stat HEAD -- 

沒有留言: