星期五, 五月 15, 2009

Git 基礎設定 (帳號的環境參數設定)

Git 基本環境設定, 主要是設定自己帳號下的環境參數.

基本資料設定

直接於 Shell 下執行下述:

  1. git config --global user.name "Tsung"
  2. git config --global user.email "username@email.com"
  3. git config --global color.diff auto # git diff 要顯示顏色
  4. git config --global color.status auto # git status 要顯示顏色
  5. git config --global color.branch auto
  6. git config --global color.log auto # git log --graph 會很漂亮, 感謝日落提供.
  7. 註: 這些設定會在 ~user/ 下產生 .gitconfig
    [color]
        diff = auto
        status = auto
        branch = auto
        log = auto
    [user]
        name = Tsung
        email = username@email.com

Git 自動忽略檔案 / 目錄設定

要自動將某些檔案掠過不 Commit, 要設定 .gitignore 這個檔案. (哪些檔案是不要 commit 進去的)

  • vim .gitignore
    tmp/**/*
    log/*
    config/database.yml
  • 使用 git add . 等, 這些都不會將這些資料列入 commit. (.gitignore 會被列入 commit)

修改預設目錄

預設會產生 .git 目錄, 改成 .test

  • 修改 Shell 變數 GIT_DIR => export GIT_DIR=.test

相關網頁

相關標籤

this is comment icon [回覆]

最后一条非常有用,谢谢!

Comment by Fwolf (05/15/2009 22:44)

this is comment icon 回 Fwolf [回覆]

我是覺得改顏色那個很方便~ ccc :P

Comment by Tsung (05/16/2009 01:18)

this is comment icon [回覆]

可以再加一個設定:
git config --global color.log auto

這樣 git log --graph 會很漂亮 :P

Comment by 日落 (03/07/2010 23:07)

this is comment icon 回 日落 [回覆]

jon

收到, 感恩~

Comment by Tsung (03/07/2010 23:13)
Add this page to del.icio.us

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~