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
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
160
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
420
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
What We Talk About When We Talk About XP
m_seki
2
380
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
870
高専キャリア LT 発表内容
crysta1221
6
5.6k
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
260
アクセシビリティから考える情報設計
high_g_engineer
0
270
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
570
不幸な GC
chencmd
0
880
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
0
140
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
3
3.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Faster Mobile Websites
deanohume
310
32k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
Designing Experiences People Love
moore
143
24k
Facilitating Awesome Meetings
lara
57
7.1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Everyday Curiosity
cassininazir
0
310
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
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