2010-12-07

[Git] Start To Git

以 ubuntu 來說,要裝 Git
$ sudo apt-get install git-core
這樣就裝好了..結束!了嗎?

# 為專案新增 Git Repositiory


假設專案的資料夾為 project
$ cd project
$ git init

git 會 reply
Initialized empty Git repository in .git/
所有 repository 所需要的資料通通會在 project/.git/ 裡面

接著將 project 裡要讓 git 追蹤的檔案加入
$ git add .
(. 指目前所在目錄,當然也可以指定檔案)

git 會把 add 的檔案暫存起來

最後輸入 commit 指令,把資料 commit
$ git commit
輸入指令後會進入編輯器,為目前的資料變動加上說明
存檔後此次 commit 的資料就會加入 repository 中


官方網站跟手冊:
Git - the fast version control system
official Git tutorial : a good place to get started.
Everyday GIT : in 20 commands is good for a useful minimum set of commands.
Git User Manual

1 則留言 :