本簡報以 GIT 為例,講述版本管理 ( Version Control ) 的觀念與 GIT 背後的原理。 相關錄影於:https://www.youtube.com/watch?v=cX9IbYgyeqc
粚矒ګ薪盢膏砺֢犥 傶ֺMouson & Duncan @ Laradubet #022016.07.14
View Slide
Ջ讕ฎ̿粚ᓕቘ̀牫
Version_20150707
Version_20150707ߺ㮆ฎ碝粚牫
硬ԧՋ讕牫
ಅ犥粚䛑扗̿ெ讕ᓕቘ̀牫
粚ᓕቘ䛑扗懿袅 4W• What 硬ԧՋ讕牫• Why 傶Ջ讕ᘒ硬牫• Who 抑硬ጱ牫• When Ջ讕碻狡硬牫
磪ߺ犚̿粚ᓕቘ̀ૡٍ牫
̿粚ᓕቘ̀ૡٍ觊ࣳ
獤碂ୗ 膏 褸Ӿୗ• 褸Ӿୗ EX: Subversion牏CVS• ಅ磪砺֢᮷ࣁӾ瓷牧䷱磪翕᪠蝫矑㳷篷ဩਂ玲• 獤碂ୗ EX: Mercurial SCM牏GIT• 瑿疰磪ਠ碉懿袅牧䷱磪翕᪠犖ݢ犥砺֢
犥 傶ֺ
GIT ጱ瞲犤
git 玟ऒ獤觊LocalLocal Repo/MasterStagingAreaWorkspace
git init - 虻碘䓚ڡতLocalLocal Repo/MasterStagingAreaWorkspacegit init
git statusLocalLocal Repo/MasterStagingAreaWorkspacegit status
GIT .gitignore 䲆礯LocalLocal Repo/MasterStagingAreaWorkspace
git add [folder/file] 碝ीLocalLocal Repo/MasterStagingAreaWorkspacegit add
git commitLocalLocal Repo/MasterStagingAreaWorkspacegit add git commit
git commit --amendLocalLocal Repo/MasterStagingAreaWorkspacegit add git commit
git commit• git commit --amend• git commit --amend --author=“Name”• git config user.name “Mou Chen”• git config user.email [email protected]• git config --global user.name “Mou Chen”
git config alias1. git config alias.co checkout• git co 缛ෝ git checkout2. git config alias.ci commit• git ci 缛ෝ git commit3. …
git ૡٍ• ZSH (http://www.zsh.org/)• oh-my-zsh (http://ohmyz.sh/)• powerline (https://github.com/powerline/powerline)• git autocomplete (https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git )
git reset […] ᯿ᗝLocalLocal Repo/MasterStagingAreaWorkspace—soft HEAD^—mixed HEAD^git reset —hard HEAD^
git checkout [. | hash]
git add -p
Ջ讕ฎ hunk ?
git logLocalLocal Repo/MasterStagingAreaWorkspacegit log
git 咳㬙ک螐ᒒ
git remote add origin [email protected]LocalLocal Repo/MasterStagingAreaWorkspace
git remote add origin [email protected]Local RemoteRemote Repo/MasterRemote Repo/MasterLocal Repo/MasterStagingAreaWorkspace
git push -u origin masterLocal RemoteRemote Repo/MasterRemote Repo/MasterLocal Repo/MasterStagingAreaWorkspacegit push
git fetchLocal RemoteRemote Repo/MasterRemote Repo/MasterLocal Repo/MasterStagingAreaWorkspacegit pushgit fetch
git mergeLocal RemoteRemote Repo/MasterRemote Repo/MasterLocal Repo/MasterStagingAreaWorkspacegit pushgit merge git fetch
git pullLocal RemoteRemote Repo/MasterRemote Repo/MasterLocal Repo/MasterStagingAreaWorkspacegit pushgit merge git fetchgit pull
Q & A