Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Git 基礎講座
Search
Davy
May 15, 2015
Programming
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git 基礎講座
Talk in
http://nos.kktix.cc/events/be177e6a
Davy
May 15, 2015
More Decks by Davy
See All by Davy
Operator SDK 帶你玩轉 Kubernetes
davy_tw
0
460
GraphQL 簡介
davy_tw
0
140
2016 計中短期資訊推廣課程 —— 多人線上繪圖板
davy_tw
0
190
Open Source Software and Culture -- Crystal
davy_tw
1
230
簡潔優雅的語言 —— Crystal
davy_tw
0
210
各種工具介紹
davy_tw
1
170
Crystal
davy_tw
0
320
Mail Server
davy_tw
0
130
PHP Cookie/Session MySQL 資料庫操作
davy_tw
1
220
Other Decks in Programming
See All in Programming
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
Verilogで学ぶCPU自作入門
uyuki234
8
4k
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
190
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
150
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
130
Are APIs Still Relevant in the AI Era?
soyuka
0
430
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
190
dotNET_vulnclicker_intro.pdf
deka_morita
0
120
APNsからLive Activityを開始する話
yumnumm
0
150
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
160
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
4
520
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Balancing Empowerment & Direction
lara
6
1.3k
Deep Space Network (abreviated)
tonyrice
0
360
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
770
Documentation Writing (for coders)
carmenintech
77
5.6k
WCS-LA-2024
lcolladotor
0
850
What does AI have to do with Human Rights?
axbom
PRO
1
2.4k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Paper Plane
katiecoart
PRO
4
54k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
Transcript
Git 基礎講座 中央大學網路開源社 資管二 郭子德
[email protected]
None
版本 控制 Revision control
None
初學者的最佳玩伴
開始寫程式
我寫寫寫……
寫完記得存檔
確認存檔無誤
編譯並執行
什麼事也沒發生 ???
加入暫停
大功告成
作業需求
勤勞是美德
原本長這樣
新增新增
修改修改
又改又改
再改再改
花了 兩天 2 days long
寫爛了 BUUUUUUUUUUG
改回來
改回來
改回來
改回來
改回來
更好的辦法
版本控制
in 人工 way
恩……?
恩……?
◢▆▅▄▃-崩╰(〒皿〒)╯潰-▃▄▅▆◣ FUUUUUUUUU
多人 合作 Teamwork
Teamwork?
互相 覆蓋 ◢▆▅▄▃-崩╰(〒皿〒)╯潰-▃▄▅▆◣
版本 控制 Revision control
本地端 版本控制 Local
本地端版本控制
集中式 版本控制 CVCS
集中式版本控制
分散式 版本控制 DVCS
分散式版本控制
None
安裝 Git Install Git
apt-get install git yum install git pacman –S git Install
Git on Linux
XCode 命令列工具 Install Git on Mac OSX
msysgit https://msysgit.github.io Install Git on Windows
git config --global user.email "
[email protected]
" git config --global user.name "Your
Name" git config --global color.ui true Setting Git
Commands git COMMAND [ARGUMENTS]
help me git COMMAND --help
clone – 複製 repository git clone git://github.com/git/hello-world.git
init – 在此建立新的 repository git init
status – 查看目前狀態 git status
log – 查看 commit 記錄 git log
diff – 查看差異 git diff
diff – 查看差異 git diff [commit_id] [file]
show – 查看 commit git show [commit_id]
Staging Area http://git-scm.com/about/staging-area
示範 git init
示範 git init
touch README.txt 示範
示範 git status
示範 On branch master Initial commit Untracked files: (use "git
add <file>..." to include in what will be committed) README.txt nothing added to commit but untracked files present (use "git add" to track)
add – 將檔案加入 Staging git add [files]
add – 將所有檔案加入 Staging git add .
示範 git add README.txt
示範 git status
示範 On branch master Initial commit Changes to be committed:
(use "git rm --cached <file>..." to unstage) new file: README.txt
reset – 將檔案移出 Staging git reset [file]
commit – 將 Staging 的檔案存入 Repository git commit
示範
commit log 格式 標題 [空行] 內容
示範
示範 [master (root-commit) 6ce65d4] Initial commit 1 file changed, 0
insertions(+), 0 deletions(-) create mode 100644 README.txt
commit log 如何 撰寫
commit log 如何 撰寫
commit log 如何 撰寫 http://www.reddit.com/r/shittyprogramming/comments/1skq3s/my_buddy_is_a_phenomenal_programmer_but_really/
如何撰寫 Commit
智慧型忽略 .gitignore
.gitignore 中繼檔 暫存檔 記錄檔
checkout – 切換到特定版本 git checkout [commit_id]
checkout – 切換到特定版本 git checkout [commit_id] [file]
branch – 建立分支 git branch BRANCH
branch Commit 別名
merge – 融合版本 git merge [commit_id]
示範
示範 git add . git commit
示範 git branch apple git branch banana git checkout apple
示範
示範 git add . git commit
示範 git checkout banana
示範
示範
示範 git add . git commit
示範 git log --graph --all
示範
示範
示範 git checkout master
示範 git merge apple
示範 Updating ea51d2c..339a0fc Fast-forward README.txt | 2 ++ 1 file
changed, 2 insertions(+)
Fast-forward 快速 前進
示範 git merge banana
示範 Auto-merging README.txt Merge made by the 'recursive' strategy. README.txt
| 2 ++ 1 file changed, 2 insertions(+)
示範
示範 Magic!
push – 推送 git push
pull – 拉回 git pull
Staging Area http://zoomq.qiniudn.com/ZQScrapBook/ZqFLOSS/data/20081210180347/
Do yourself 嘗試 看看
Ref https://speakerdeck.com/crboy/code-smart- dont-code-hard Code Smart, Don't Code hard by
crboy http://denny0223.github.io/HackGen-2014- workshop/#28 Git by Denny Huang
Q & A 任何 問題