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
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
86
JavaScript 基礎入門
brian90191
0
49
Other Decks in Programming
See All in Programming
The Rails Doctrine Decade
koic
2
130
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
120
Family mrubyの進捗
kishima
1
130
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2k
速習iPhone Duo対応
yuukiw00w
1
650
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
180
すこし踏み込む CancellationToken
htkym
2
580
What We Talk About When We Talk About XP
m_seki
2
660
Webの地図
yosuke_furukawa
PRO
6
4.6k
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
550
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
610
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
15k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Typedesign – Prime Four
hannesfritz
42
3.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
A better future with KSS
kneath
240
18k
Ethics towards AI in product and experience design
skipperchong
2
380
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
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