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
Introduction of Git
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Brian
March 29, 2021
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction of Git
Brian
March 29, 2021
More Decks by Brian
See All by Brian
微服務開發及容器化基礎介紹
brian90191
0
88
JavaScript 基礎入門
brian90191
0
49
Other Decks in Programming
See All in Programming
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
Event is what happens
moro
2
770
contenteditable と日本語入力に向き合う
colorful12
0
200
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
Jetpack Compose Mechanisms
skydoves
3
820
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
600
Side Projects
sachag
456
43k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Mind Mapping
helmedeiros
1
400
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
480
Darren the Foodie - Storyboard
khoart
PRO
4
4k
A better future with KSS
kneath
240
18k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
590
Statistics for Hackers
jakevdp
799
230k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Transcript
Git 入⾨ Git 入⾨ 葉鎰維 (Brian) 葉鎰維 (Brian) CSI Technology
Group CSI Technology Group Email: Email:
[email protected]
[email protected]
1 1
集中式版本控制系統 集中式版本控制系統 2 2
分散式版本控制系統 (Git) 分散式版本控制系統 (Git) 3 3
關於 Git 關於 Git 作者: 作者: Git 的操作可以在⾃⼰ local,不需要網路 Git
的操作可以在⾃⼰ local,不需要網路 , , 都是透過 Git 進⾏版本控制的原始 都是透過 Git 進⾏版本控制的原始 碼代管服務平台 碼代管服務平台 所有檔案都可以 git,起⼿式 => 所有檔案都可以 git,起⼿式 => git init git init Linus Torvalds Linus Torvalds Github Github Gitlab Gitlab 4 4
Git 的優點 Git 的優點 1. 免費、開源 免費、開源 2. 速度快、檔案體積⼩ 速度快、檔案體積⼩
Git 並不是記錄版本的差異,⽽是記錄檔案內容的 Git 並不是記錄版本的差異,⽽是記錄檔案內容的 「快照」(snapshot),它可以讓 Git 在非常快 「快照」(snapshot),它可以讓 Git 在非常快 速的切換版本 速的切換版本 3. 分散式系統 分散式系統 5 5
Git 的缺點 Git 的缺點 1. 易學難精 易學難精 2. 非常多指令 (Command
Line) 非常多指令 (Command Line) ⼆八法則,記住 20% 的指令就很夠⽤ ⼆八法則,記住 20% 的指令就很夠⽤ 有很多圖形化介⾯⼯具輔助,已⼤幅降低使 有很多圖形化介⾯⼯具輔助,已⼤幅降低使 ⽤的⾨檻 ⽤的⾨檻 6 6
安裝 Git 安裝 Git 下載: 下載: ⼀步到底 ⼀步到底 開啟 Git
Bash 並輸入以下指令 開啟 Git Bash 並輸入以下指令 https://git-scm.com/download/win https://git-scm.com/download/win $ $ which which git git /mingw64/bin/git /mingw64/bin/git $ git --version $ git --version git version 2.21.0.windows.1 git version 2.21.0.windows.1 7 7
圖形化介⾯⼯具 圖形化介⾯⼯具 Sourcetree Sourcetree GitKraken GitKraken TortoiseGit TortoiseGit 8 8
git config git config # 設定 email # 設定 email
$ git config --global user.email $ git config --global user.email "
[email protected]
" "
[email protected]
" # 設定名稱 # 設定名稱 $ git config --global user.name $ git config --global user.name "test" "test" # 檢視⽬前設定 # 檢視⽬前設定 $ git config --list $ git config --list 9 9
git init git init 新增、初始 Repository 新增、初始 Repository # 切換⾄
/tmp ⽬錄 # 切換⾄ /tmp ⽬錄 $ $ cd cd /tmp /tmp # 建立 git-practice ⽬錄 # 建立 git-practice ⽬錄 $ mkdir git-practice $ mkdir git-practice # 切換⾄ git-practice ⽬錄 # 切換⾄ git-practice ⽬錄 $ $ cd cd git-practice git-practice # 初始化這個⽬錄,讓 Git 對這個⽬錄開始進⾏版控 # 初始化這個⽬錄,讓 Git 對這個⽬錄開始進⾏版控 $ git init $ git init 10 10
解除 Git 控制 解除 Git 控制 把 把 .git .git
這個⽬錄移除就可以了!!! 這個⽬錄移除就可以了!!! 11 11
git status git status 查看檔案狀態 查看檔案狀態 顯⽰沒有東⻄可以被提交 (commit) 顯⽰沒有東⻄可以被提交 (commit)
我們試著新增⼀個檔案看看 我們試著新增⼀個檔案看看 $ git status $ git status Initial commit Initial commit nothing to commit (create/copy files and use nothing to commit (create/copy files and use "git add" "git add" to track) to track) 12 12
git add git add 把檔案放到暫存區 (Staging Area),讓 Git 開始「追 把檔案放到暫存區
(Staging Area),讓 Git 開始「追 蹤」它 蹤」它 # 加入特定檔案 # 加入特定檔案 $ git add xxx.html $ git add xxx.html # 加入特定副檔名的檔案 # 加入特定副檔名的檔案 $ git add *.html $ git add *.html # 加入全部檔案 # 加入全部檔案 $ git add --all $ git add --all 13 13
git commit git commit 把暫存區的內容提交到倉庫裡存檔 把暫存區的內容提交到倉庫裡存檔 Commit 的 message 非常重要!
代表這個修改做了什 Commit 的 message 非常重要! 代表這個修改做了什 麼,⼀定要明確表達 麼,⼀定要明確表達 $ git commit -m $ git commit -m "init commit" "init commit" [master (root-commit) dfccf0c] init commit [master (root-commit) dfccf0c] init commit 1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+) create mode 100644 xxx.html create mode 100644 xxx.html 14 14
如何使⽤ Github 如何使⽤ Github 15 15
New Repository New Repository 全新專案 全新專案 上傳現存專案 上傳現存專案 16 16
Push & Pull Push & Pull # 更新遠端上當前分⽀ # 更新遠端上當前分⽀
$ git push $ git push # 把當前分⽀拉回本機更新 # 把當前分⽀拉回本機更新 $ git pull $ git pull 17 17
Clone Repository Clone Repository # 會使⽤原本的⽬錄名稱 # 會使⽤原本的⽬錄名稱 $ git
$ git clone clone https://github.com/18chetanpatel/shipit.git https://github.com/18chetanpatel/shipit.git # 後⾯加上名稱,即可存成不同的⽬錄名稱 # 後⾯加上名稱,即可存成不同的⽬錄名稱 $ git $ git clone clone https://github.com/18chetanpatel/shipit.git xxxx https://github.com/18chetanpatel/shipit.git xxxx 18 18
Clone 跟 Pull 這兩個指令的應⽤場景是不同的 Clone 跟 Pull 這兩個指令的應⽤場景是不同的 如果這個專案你是第⼀次看到,想要下載到你的 如果這個專案你是第⼀次看到,想要下載到你的
電腦裡,請使⽤ Clone 指令 電腦裡,請使⽤ Clone 指令 如果你已經下載回來了,你只是想要更新最新的 如果你已經下載回來了,你只是想要更新最新的 線上版內容,請使⽤ Pull 指令 線上版內容,請使⽤ Pull 指令 19 19
淺談 Git Flow 淺談 Git Flow 重點是 Flow 是要讓開發團隊所有⼈都遵守同⼀套流程 重點是
Flow 是要讓開發團隊所有⼈都遵守同⼀套流程 https://gitbook.tw/chapters/gitflow/why-need- https://gitbook.tw/chapters/gitflow/why-need- git-flow.html git-flow.html https://gitbook.tw/chapters/gitflow/using-git- https://gitbook.tw/chapters/gitflow/using-git- flow.html flow.html 20 20
Reference Reference 為你⾃⼰學 Git 為你⾃⼰學 Git Git 入⾨與應⽤ Git 入⾨與應⽤
21 21