git basic
TRANSCRIPT
Git Basic
Browny2010.12.06
Outline
• Introduction to Git• Install Git• Basic Commands• Git Branch• Git and Dropbox• Resources
rcs
Centralized Version Control System (CVCS)
• CVS• Subversion• Perforce• etc…
Distributed Version Control System (DVCS)
• Git• Mercurial• Bazaar• etc…
Snapshot, not Differences
CVS
Git
Flow
Outline
• Introduction to Git• Install Git• Basic Commands• Git Branch• Git and Dropbox• Resources
Install Git on Windows
• msysgit - http://code.google.com/p/msysgit/
Initialization
• 設定 ID 和 Email$ git config --global user.name “browny" $ git config --global user.email [email protected]
• 查看設定資料$ git config --list
Outline
• Introduction to Git• Install Git• Basic Commands• Git Branch• Git and Dropbox• Resources
Basic Commands (1)
• 初始化一個 git 倉庫$ git init
• 將檔案放入暫存夾等候 commit$ git add
• 指定要忽略 commit 的檔案 (create a file in your repo named .gitignore)*.[oa] :忽略所有 .o 和 .a 檔案*~ :忽略所有 ~ 檔案
Basic Commands (2)
• 觀看狀態$ git status
• 提交 $ git commit
• 幫某次 commit 加上含附註的標籤 tag$ git tag –a v1.1 –m ‘version 1.1’
• 觀看提交歷程$ git log
Basic Commands (3)
• 複製遠端 repo.$ git clone git://github.com/schacon/grit.git
• 自定義複製來的 repo. 名稱$ git clone git://github.com/schacon/grit.git mygrit
Basic Commands (4)
• 查看現有的分支$ git branch
• 建立新的分支$ git branch 分支名稱
• 切換到主幹上$ git checkout master
• 切換到某個分支上git checkout 分支名稱
Outline
• Introduction to Git• Install Git• Basic Commands• Git Branch• Git and Dropbox• Resources
First Commit
Multiple Commit
master
Make a branch
• $ git branch testing
Re-direct HEAD
• $ git checkout testing
Commit on testing
Back to master
• $ git checkout master
Commit on master
Outline
• Introduction to Git• Install Git• Basic Commands• Git Branch• Git and Dropbox• Resources
Dropbox Setting
Set up cloud repo.
• Make a directory in Dropbox $ mkdir /GitRepo/opencv-gradient.git$ cd /GitRepo/opencv-gradient.git
• Initialize it $ git init --bare
Push repo. to Cloud
• Go to your work directory $ cd /EclipseWork/opencv-gradient
• Add a remote alias (git remote add alias URI)$ git remote add drop-opencv-gradient file:///C:/Documents%20and%20Settings/....../GitRepo/opencv-gradient.git
• Push working repo. to Dropbox repo.$ git push drop-opencv-gradient master
Get repo. from Cloud
• git clone URI directoryName• $ git clone file:///C:/Documents%20and%20Settings/....../GitRepo/opencv-gradient.git opencv-gradient
Resources
• Git - http://git-scm.com/• Pro Git 簡體翻譯 -
http://progit.org/book/zh/• Git 初學文件整理 | Tsung's Blog -
http://plog.longwin.com.tw/my_note-unix/2009/05/14/git-learn-initial-document-2009