Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction of Git
Search
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
85
JavaScript 基礎入門
brian90191
0
48
Other Decks in Programming
See All in Programming
What We Talk About When We Talk About XP
m_seki
2
380
アクセシビリティから考える情報設計
high_g_engineer
0
270
信頼性の目標を誰も求めてない
shubox
0
490
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
140
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.7k
スマート反転とウェブアクセシビリティ
camiha
0
130
高専キャリア LT 発表内容
crysta1221
6
5.6k
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
6
2.5k
ALB ログから Trace を気合で繋げる技術
fohte
7
880
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
130
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
480
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
450
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
770
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
4 Signs Your Business is Dying
shpigford
187
23k
Designing for Timeless Needs
cassininazir
1
470
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
Building an army of robots
kneath
306
46k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
260
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