版權聲明

所有的部落格文章都可以在右邊[blog文章原始檔案]下載最原始的文字檔案,並依你高興使用 docutil 工具轉換成任何對應的格式方便離線閱覽,除了集結成書販賣歡迎任意取用,引用

Git 安裝與設定

Git

Install

到官網抓 http://git-scm.com/ 最新版本。

然後進行標準 linux 安裝程序..

gunzip git-1.6.3.3.tar
tar -xvf git-1.6.3.3.tar
make configure
./configure --prefix=/usr/local
make all
sudo make install  install-doc install-html

如果要安裝說明文件(man html..),要另外編譯因為 Git 的說明文件使用了預設可能 不會安裝的工具 asciidoc 和 xmlto,因此如果要編譯說明文件請先確認系統已經安裝 了這兩個程式。

編譯說明文件..

make doc
make install-doc

設定user name和email

git config --global user.name "myNameHere"
git config --global user.email myEmail@gmail.com

我安裝在 macbook 上 commit 會出現錯誤

error: There was a problem with the editor 'vi'.

不知道什麼原因,後來將 editor 設定成 textmate 就ok了..

git config core.editor "mate -w"

一些其他設定

上色

在 .gitconfig (HOME 目錄下面) 加上下面設定:

[color]
   branch = auto
   diff = auto
   status = auto
[color "branch"]
   current = yellow reverse
   local = yellow
   remote = green
[color "diff"]
   meta = yellow bold
   frag = magenta bold
   old = red bold
   new = green bold
[color "status"]
   added = yellow
   changed = green
   untracked = cyan

用外部Diff工具

寫一個 script 包裝工具的參數比如要使用 DiffMerge

#$2=old file   $5=new file
#依照實際環境設定可能需要明確指出DiffMerge的路徑
diffMerge $2 $5

然後到 .gitconfig 加上設定

[diff]
     #剛剛寫的scripte路徑和檔名
     external = /usr/local/bin/git-diffmerge-wrapper.sh

沒有留言:

Related Posts with Thumbnails