SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Git
一個版本控制系統
Version Control System (VCS)
1. 認識 git
2. 操作 github
3. 發佈網頁 (gh-pages)
今日任務
什麼是 git ?
在軟體開發的過程中,程式碼每天不斷地產
出,過程中會發生以下情況:
• 檔案被別人或自己覆蓋,甚至遺失
• 想復原前幾天寫的版本
• 想知道跟昨天寫的差在哪裡
• 是誰改了這段程式碼,為什麼
• 軟體發行,需要分成維護版跟開發版
Reference : https://ihower.tw/git/vcs.html
git 能幫助我們解決這些問題:
• 可以隨時復原修改,回到之前的版本
• 多人協作時,不會把別人的東西蓋掉
• 保留修改歷史記錄,以供查詢
• 軟體發行時,可以方便管理不同版本
Reference : https://ihower.tw/git/vcs.html
認識 git
• Repository 一個專案
• Branch 專案支線
• Commit 時間軸上的一筆更動
Commit Branch
Repository
什麼是 github
Git 跟 Github
• Git 檔案版本控制軟體
• Github 以 git 為基礎擴充伺服器服務,
使專案更便於發佈與協作
Git
Github
來看看別人的 Github
• Github :
https://github.com/johnpolacek/superscroll
orama
• Github
pages :http://johnpolacek.github.io/supersc
rollorama/
開始使用 Github GUI
1. 註冊安裝 github
2. 新增專案 (repository)
3. 建立變更記錄 (commit)
4. 捨棄先前變更 (revert)
5. 新增專案分支 (branch)
6. 創建自己的 (gh-pages)
7. 與伺服器同步 (sync)
註冊安裝 github
註冊好 github,並完成認證
下載並安裝 github
• windows : https://windows.github.com/
• mac :
https://mac.github.com/
* Gui : 圖形使用者界面
新增專案 (repository)
兩種方式:
• 在網頁上新增 create
• 在本機上新增
– Add : 將本機內其他 repo 加進來管理
– Create : 在本機創建一個 git repository
– Clone : 從遠端下載到本機指定資料夾
Remote repository
Local repository
找到你設定的資料夾 repo ,
在裡面新建檔案
這時候 github 軟體 會偵測到你的變更
這時候你就可以到 github 做 commit
建立變更記錄 (commit)
會新增一個變更節點
• What / why / who
/ when / where / how commit
再回到你的 repo 資料夾,在新建一個檔案
然後建立第二個 commit
捨棄先前變更 (revert)
• 捨棄某 commit
• 回復到特定 commit
http://stackoverflow.com/questions/411409
5/revert-to-a-previous-git-commit
這時候到你的資料夾看一下~
第二個建立的檔案就不見了
新增專案分支 (branch)/
• 從最後一個 commit 為基準,建立一個分支
• gh-pages : Github公開網頁分支
• 網址 : <帳號>.github.io/<repo nmae>
branch
建立 gh-pages 後
將 branch 切回 master branch
回到你的 repo 資料夾,
在master branch 底下新建一個檔案
然後建立第三個 commit
建立完 commit 回到 github 軟體
切換 branch 到 gh-pages
回到你的 repo 資料夾 看看結果
(補充 合併 branch)
git Merge <branch>
• 常用此功能將此分支的變更推回去原分支
與伺服器同步 (sync)
• Publish : 將本機的專案(repo) 公開到網路上
• Sync : 本機執行 push 跟 pull
– Git push 將本機變更同步到遠端
– Git pull 將遠端變更同步到本機
補充
Github 每個目錄底下都可以放一個Readme
讓其他使用者或開發者便於了解你的軟件
網站上也可直接進行編輯,
和查看所有的歷史。
Readme file 的檔案類型是 markdown
在 stackover flow 發問時也用的到
Github and stackoverflow markdown :
https://help.github.com/articles/github-flavored-markdown/
http://stackoverflow.com/editing-help
$想要用git command line ?
https://help.github.com/articles/set-up-git/
$常用指令
Repository
• git init
Commit
• git status
• git add <file name>
• git commit –m <message>
• git revert
• git checkout <commit SHA>
Branch
• git checkout <branch>
• git merge <branch> 合併
• git branch <branch> 新增
Version control
• git tag
History
• git log
Sync
• git remote
• git push 推
• git pull 更新
$很不錯的資源
Git 指令用用看
https://try.github.io/levels/1/challenges/1
Git 指令教學 (圖示、淺白)
https://www.atlassian.com/git/tutorials/setting-up-a-
repository
Git 官網
http://git-scm.com/
中文的 git 解說
https://ihower.tw/git/vcs.html
$ 待續…
Git 協作
http://tech.marsw.tw/blog/2013/08/17/git-
notes-github-n-person-cooperation-settings

Weitere ähnliche Inhalte

Was ist angesagt?

A successful git branching model 導讀
A successful git branching model 導讀A successful git branching model 導讀
A successful git branching model 導讀Wen Liao
 
Git&Github Tutorial
Git&Github TutorialGit&Github Tutorial
Git&Github TutorialTing Wen Su
 
Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)Hsin-lin Cheng
 
工程師必備第一工具 - Git
工程師必備第一工具 - Git工程師必備第一工具 - Git
工程師必備第一工具 - GitAlan Tsai
 
代码版本控制那点事
代码版本控制那点事代码版本控制那点事
代码版本控制那点事利鹏 宋
 
Git 入門與實作
Git 入門與實作Git 入門與實作
Git 入門與實作奕浦 郭
 
20170510 git 懶人包
20170510 git 懶人包20170510 git 懶人包
20170510 git 懶人包Chen-Ming Yang
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略Lucien Lee
 
Git前世今生
Git前世今生Git前世今生
Git前世今生hiyco
 
Git Flow 管理
Git Flow 管理Git Flow 管理
Git Flow 管理Pu Lee
 
簡介 GitHub 平台
簡介 GitHub 平台簡介 GitHub 平台
簡介 GitHub 平台Will Huang
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战icy leaf
 
Git & Sourcetree 介紹
Git & Sourcetree 介紹Git & Sourcetree 介紹
Git & Sourcetree 介紹Adison wu
 
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence TutorialHo Kim
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用Will Huang
 
Using source tree
Using source treeUsing source tree
Using source treeAbby Lai
 

Was ist angesagt? (20)

A successful git branching model 導讀
A successful git branching model 導讀A successful git branching model 導讀
A successful git branching model 導讀
 
Git 简介
Git 简介Git 简介
Git 简介
 
Git&Github Tutorial
Git&Github TutorialGit&Github Tutorial
Git&Github Tutorial
 
Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)
 
工程師必備第一工具 - Git
工程師必備第一工具 - Git工程師必備第一工具 - Git
工程師必備第一工具 - Git
 
代码版本控制那点事
代码版本控制那点事代码版本控制那点事
代码版本控制那点事
 
Git 入門與實作
Git 入門與實作Git 入門與實作
Git 入門與實作
 
20170510 git 懶人包
20170510 git 懶人包20170510 git 懶人包
20170510 git 懶人包
 
初心者 Git 上手攻略
初心者 Git 上手攻略初心者 Git 上手攻略
初心者 Git 上手攻略
 
Git前世今生
Git前世今生Git前世今生
Git前世今生
 
Git Flow 管理
Git Flow 管理Git Flow 管理
Git Flow 管理
 
簡介 GitHub 平台
簡介 GitHub 平台簡介 GitHub 平台
簡介 GitHub 平台
 
Git簡介
Git簡介Git簡介
Git簡介
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战
 
Git for everyone
Git for everyoneGit for everyone
Git for everyone
 
Git & Sourcetree 介紹
Git & Sourcetree 介紹Git & Sourcetree 介紹
Git & Sourcetree 介紹
 
Git Essence Tutorial
Git Essence TutorialGit Essence Tutorial
Git Essence Tutorial
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
 
Git
GitGit
Git
 
Using source tree
Using source treeUsing source tree
Using source tree
 

Andere mochten auch

Big Data Science in the Cloud from Big Data World Conference 2013
Big Data Science in the Cloud from Big Data World Conference 2013Big Data Science in the Cloud from Big Data World Conference 2013
Big Data Science in the Cloud from Big Data World Conference 2013Markus Schmidberger
 
Coastal flood risk ABI conference nov06
Coastal flood risk ABI conference nov06Coastal flood risk ABI conference nov06
Coastal flood risk ABI conference nov06Jane Bevis
 
(New) final exam for qnt 351 all correct answers 100%
(New) final exam for qnt 351 all correct answers 100%(New) final exam for qnt 351 all correct answers 100%
(New) final exam for qnt 351 all correct answers 100%quikly11
 
Please don’t leave me cast
Please don’t leave me castPlease don’t leave me cast
Please don’t leave me castMarielly13
 
(New) final exam for acc 460 all correct answers 100%
(New) final exam for acc 460 all correct answers 100%(New) final exam for acc 460 all correct answers 100%
(New) final exam for acc 460 all correct answers 100%quikly11
 
On-Pack Recycling Label scheme
On-Pack Recycling Label schemeOn-Pack Recycling Label scheme
On-Pack Recycling Label schemeJane Bevis
 
Por qué no se me ocurrió a mi
Por qué no se me ocurrió a miPor qué no se me ocurrió a mi
Por qué no se me ocurrió a miTaTa Vargas
 
(New) final exam for bis 220 all correct answers 100%
(New) final exam for bis 220 all correct answers 100%(New) final exam for bis 220 all correct answers 100%
(New) final exam for bis 220 all correct answers 100%quikly11
 
Implications of climate change for insurance ciwem07
Implications of climate change for insurance ciwem07Implications of climate change for insurance ciwem07
Implications of climate change for insurance ciwem07Jane Bevis
 
(New) final exam for mgt 527 all correct answers 100%
(New) final exam for mgt 527 all correct answers 100%(New) final exam for mgt 527 all correct answers 100%
(New) final exam for mgt 527 all correct answers 100%quikly11
 
(New) final exam for law 531 all correct answers 100%
(New) final exam for law 531 all correct answers 100%(New) final exam for law 531 all correct answers 100%
(New) final exam for law 531 all correct answers 100%quikly11
 
Sustainability and waste: A UK retail perspective feb 09 (2)
Sustainability and waste: A UK retail perspective feb 09 (2)Sustainability and waste: A UK retail perspective feb 09 (2)
Sustainability and waste: A UK retail perspective feb 09 (2)Jane Bevis
 
Uk retail prospects Jan 2012
Uk retail prospects Jan 2012Uk retail prospects Jan 2012
Uk retail prospects Jan 2012Jane Bevis
 
(New) final exam for fin 370 all correct answers 100%
(New) final exam for fin 370 all correct answers 100%(New) final exam for fin 370 all correct answers 100%
(New) final exam for fin 370 all correct answers 100%quikly11
 
Design a Course the Adler Online Way
Design a Course the Adler Online WayDesign a Course the Adler Online Way
Design a Course the Adler Online Waycolleenfleming
 
(New) final exam for mgt 498 all correct answers 100%
(New) final exam for mgt 498 all correct answers 100%(New) final exam for mgt 498 all correct answers 100%
(New) final exam for mgt 498 all correct answers 100%quikly11
 
Retail in Northern Ireland
Retail in Northern IrelandRetail in Northern Ireland
Retail in Northern IrelandJane Bevis
 
Carbon footprinting feb 2008
Carbon footprinting feb 2008Carbon footprinting feb 2008
Carbon footprinting feb 2008Jane Bevis
 

Andere mochten auch (19)

Big Data Science in the Cloud from Big Data World Conference 2013
Big Data Science in the Cloud from Big Data World Conference 2013Big Data Science in the Cloud from Big Data World Conference 2013
Big Data Science in the Cloud from Big Data World Conference 2013
 
Coastal flood risk ABI conference nov06
Coastal flood risk ABI conference nov06Coastal flood risk ABI conference nov06
Coastal flood risk ABI conference nov06
 
(New) final exam for qnt 351 all correct answers 100%
(New) final exam for qnt 351 all correct answers 100%(New) final exam for qnt 351 all correct answers 100%
(New) final exam for qnt 351 all correct answers 100%
 
Please don’t leave me cast
Please don’t leave me castPlease don’t leave me cast
Please don’t leave me cast
 
(New) final exam for acc 460 all correct answers 100%
(New) final exam for acc 460 all correct answers 100%(New) final exam for acc 460 all correct answers 100%
(New) final exam for acc 460 all correct answers 100%
 
On-Pack Recycling Label scheme
On-Pack Recycling Label schemeOn-Pack Recycling Label scheme
On-Pack Recycling Label scheme
 
Por qué no se me ocurrió a mi
Por qué no se me ocurrió a miPor qué no se me ocurrió a mi
Por qué no se me ocurrió a mi
 
(New) final exam for bis 220 all correct answers 100%
(New) final exam for bis 220 all correct answers 100%(New) final exam for bis 220 all correct answers 100%
(New) final exam for bis 220 all correct answers 100%
 
Implications of climate change for insurance ciwem07
Implications of climate change for insurance ciwem07Implications of climate change for insurance ciwem07
Implications of climate change for insurance ciwem07
 
(New) final exam for mgt 527 all correct answers 100%
(New) final exam for mgt 527 all correct answers 100%(New) final exam for mgt 527 all correct answers 100%
(New) final exam for mgt 527 all correct answers 100%
 
(New) final exam for law 531 all correct answers 100%
(New) final exam for law 531 all correct answers 100%(New) final exam for law 531 all correct answers 100%
(New) final exam for law 531 all correct answers 100%
 
Sustainability and waste: A UK retail perspective feb 09 (2)
Sustainability and waste: A UK retail perspective feb 09 (2)Sustainability and waste: A UK retail perspective feb 09 (2)
Sustainability and waste: A UK retail perspective feb 09 (2)
 
Uk retail prospects Jan 2012
Uk retail prospects Jan 2012Uk retail prospects Jan 2012
Uk retail prospects Jan 2012
 
State cah 2013
State cah 2013State cah 2013
State cah 2013
 
(New) final exam for fin 370 all correct answers 100%
(New) final exam for fin 370 all correct answers 100%(New) final exam for fin 370 all correct answers 100%
(New) final exam for fin 370 all correct answers 100%
 
Design a Course the Adler Online Way
Design a Course the Adler Online WayDesign a Course the Adler Online Way
Design a Course the Adler Online Way
 
(New) final exam for mgt 498 all correct answers 100%
(New) final exam for mgt 498 all correct answers 100%(New) final exam for mgt 498 all correct answers 100%
(New) final exam for mgt 498 all correct answers 100%
 
Retail in Northern Ireland
Retail in Northern IrelandRetail in Northern Ireland
Retail in Northern Ireland
 
Carbon footprinting feb 2008
Carbon footprinting feb 2008Carbon footprinting feb 2008
Carbon footprinting feb 2008
 

Ähnlich wie Github簡介

COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報Bachue Zhou
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍medcl
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTreeChu-Siang Lai
 
Git & git flow
Git & git flowGit & git flow
Git & git flowAmo Wu
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshellNelson Tai
 
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Wen-Tien Chang
 
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Cloud Tu
 
Learn git
Learn gitLearn git
Learn git甘 李
 
Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门Rongxing Liu
 
版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub維佋 唐
 
簡介 Git hub 平台 ( 1.5 hrs )
簡介 Git hub 平台 ( 1.5 hrs )簡介 Git hub 平台 ( 1.5 hrs )
簡介 Git hub 平台 ( 1.5 hrs )Will Huang
 
Intro to Git 投影片
Intro to Git 投影片Intro to Git 投影片
Intro to Git 投影片Tony Yeh
 
Git and git hub
Git and git hubGit and git hub
Git and git hub唯 李
 
Git入门与实践
Git入门与实践Git入门与实践
Git入门与实践LC2009
 
Git原理与实战 201607
Git原理与实战 201607Git原理与实战 201607
Git原理与实战 201607Charles Tang
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to gitBo-Yi Wu
 
Git introduction
Git introductionGit introduction
Git introductionmythnc
 
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)flylon
 

Ähnlich wie Github簡介 (20)

COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍
 
Git and Github basic with SourceTree
Git and Github basic with SourceTreeGit and Github basic with SourceTree
Git and Github basic with SourceTree
 
Git & git flow
Git & git flowGit & git flow
Git & git flow
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)
 
Learn git
Learn gitLearn git
Learn git
 
Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门
 
版本控制 使用Git & git hub
版本控制   使用Git & git hub版本控制   使用Git & git hub
版本控制 使用Git & git hub
 
簡介 Git hub 平台 ( 1.5 hrs )
簡介 Git hub 平台 ( 1.5 hrs )簡介 Git hub 平台 ( 1.5 hrs )
簡介 Git hub 平台 ( 1.5 hrs )
 
20160420 - git intro
20160420 - git intro20160420 - git intro
20160420 - git intro
 
Intro to Git 投影片
Intro to Git 投影片Intro to Git 投影片
Intro to Git 投影片
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Git入门与实践
Git入门与实践Git入门与实践
Git入门与实践
 
Git原理与实战 201607
Git原理与实战 201607Git原理与实战 201607
Git原理与实战 201607
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)
 

Github簡介