git
Yeast Liu
2014.04.01 @ NISRA
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
Outline
• About Version Control
• What is “Version Control” ?
• Version Control Systems
• Local Version Control Systems
• ...
About Version Control
• What is version control ?
• Local Version Control Systems
• 在 local 各自建立版本資料庫
• 協作開發困難
• Centraliz...
Local Version Control Systems
commit
Centralized Version Control Systems
commit
Distributed
Version Control
Systems
commit
push/pull
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git and Github
• Git GUI
• G...
What is Git?
• A distributed version control system.
• Designed and developed by Linus Torvalds.
• A distributed revision ...
What is Git? – Other VCS
• Store data as changes.
What is Git? – Git VCS
• DAG ( Directed Acyclic Graph):
Store data as snapshots.
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Installing Git
• First-Time Git Setup
• G...
Getting Started : Installing Git
• Install git on Windows
• Install git on Ubuntu
$ sudo apt-get install git
http://msysgi...
Getting Started : Git Setup
$ git config --global user.name “Your Name”
• First-Time git setup
$ git config --global user....
Getting Started : Git Setup
$ cat ~/.gitconfig or
$ vim ~/.gitconfig or
$ git config –list
• Check your git configuration....
Getting Started : Getting Help
$ git help <command> or
$ git <command> --help
• Get the manual page for help.
$ git help c...
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git Repository
• Commands
• ...
Getting Basics : Git Repository (Repo)
• Repositories
• 一個儲存專案中所有修訂資訊、歷史紀錄的資料庫
• .git 是一個隱藏目錄, 存放 Repo 所需要的資訊.
Getting Basics : Git Repository (Repo)
Git Basics : Git Repository (Repo)
• Git Repo : 一個被 Git 追蹤的專案
• Repo stored the collection of files and their
complete his...
Git Basics : Git Repository (Repo)
3
3
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git Repository
• Commands
• ...
Git Basics : Commands
• Create a empty directory.
• Create git repository.
$ mkdir hellogit
$ cd hellogit
$ git init
Git Basics : Commands
• Create content
• Show content
$ touch data.txt
$ echo “content” > data.txt
$ echo “concat” >> data...
Git Basics : Commands
• See the current status.
$ git status
Git Basics : Commands
• Add file to the staging area.
$ git add data.txt
$ git add .
Git Basics : Commands
• Remove file to the staging area.
$ git rm data.txt
Git Basics : Commands
• Commit file to the local repository.
$ git commit –m “Your commit msg”
Git Basics : Commands
• Show git log for the change.
$ git log
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git and Github
• Git GUI
• G...
• Make a new repository on GitHub.
Github : Git and Github
• Make a new repository on GitHub.
Github : Git and Github
“Your Repo Name”
• Creates a remote named “origin” pointing at
your github repo.
Github : Git and Github
$ git remote add origin “URL”
“ UR...
• Push your commit.
Github : Git and Github
$ git push origin master
• Push your commit.
Github : Git and Github
$ git push origin master
• Push your commit.
Github : Git and Github
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
Git GUI
• Graphical Git Client for Linux
• Git-cola
• Gitg
• SmartGit
• Giggle
• Git Gui
• qGit
• gitk
Git GUI
• Gitk
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branch...
Git Branching : Data Structures
紀錄檔案內容
檔案目錄
紀錄訊息
Git Branching : Data Structures
• Single commit repository data.
Git Branching : Data Structures
• Git object data for multiple commits.
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branch...
Git Branching: About Branching
• Create a new branch.
$ git branch testing
“ Your branch name”
Git Branching: About Branching
• Switch to an existing branch.
$ git checkout testing
“ Your branch name”
Git Branching: About Branching
• Switch to an existing branch.
$ git checkout testing
“ Your branch name”
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branch...
Git Branching: Merge Branches
$ git checkout –b iss53
“ Your branch name”
Git Branching: Merge Branches
index.html
$ vim index.html
$ git add
$ git commit –m “issue 53”
index.html
index.html
$ git checkout master
$ git checkout –b hotfix
$ vim index.html
$ vim add
$ git commit –m “hotfix”
index.html
index.html
$ git checkout master
$ git merge hotfix
$ git branch –d hotfix
$ git checkout master
$ git merge iss53
master and iss53 :
no common ancestors
master and iss53 :
no common ancestors
Reference
• Git Documentation
• http://git-scm.com/documentation
• 版本控制系統Git 精要| ihower 的Git 教室
• http://ihower.tw/git/rem...
Q & A 愚人節快樂 :)
Git
Upcoming SlideShare
Loading in...5
×

Git

325

Published on

NISRA 2014.04.01

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
325
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Git

  1. 1. git Yeast Liu 2014.04.01 @ NISRA
  2. 2. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching
  3. 3. Outline • About Version Control • What is “Version Control” ? • Version Control Systems • Local Version Control Systems • Centralized Version Control Systems • Distributed Version Control Systems • Hello, Git! • Git GUI • Git Branching
  4. 4. About Version Control • What is version control ? • Local Version Control Systems • 在 local 各自建立版本資料庫 • 協作開發困難 • Centralized Version Control Systems • 利用一台中央 Server 儲存所有版本紀錄 • SVN ( Subversion ) • Server 負擔大 • Distributed Version Control Systems • 每個 local 都有一個版本資料庫 • git
  5. 5. Local Version Control Systems commit
  6. 6. Centralized Version Control Systems commit
  7. 7. Distributed Version Control Systems commit push/pull
  8. 8. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git and Github • Git GUI • Git Branching
  9. 9. What is Git? • A distributed version control system. • Designed and developed by Linus Torvalds. • A distributed revision control and source code management system.
  10. 10. What is Git? – Other VCS • Store data as changes.
  11. 11. What is Git? – Git VCS • DAG ( Directed Acyclic Graph): Store data as snapshots.
  12. 12. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Installing Git • First-Time Git Setup • Get Help • Git Basics • Git and Github • Git GUI • Git Branching
  13. 13. Getting Started : Installing Git • Install git on Windows • Install git on Ubuntu $ sudo apt-get install git http://msysgit.github.io/
  14. 14. Getting Started : Git Setup $ git config --global user.name “Your Name” • First-Time git setup $ git config --global user.email “Your Email”
  15. 15. Getting Started : Git Setup $ cat ~/.gitconfig or $ vim ~/.gitconfig or $ git config –list • Check your git configuration. • ~/.gitconfig • 是隱藏在 home folder 中的設定檔
  16. 16. Getting Started : Getting Help $ git help <command> or $ git <command> --help • Get the manual page for help. $ git help config
  17. 17. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git Repository • Commands • Git and Github • Git GUI • Git Branching
  18. 18. Getting Basics : Git Repository (Repo) • Repositories • 一個儲存專案中所有修訂資訊、歷史紀錄的資料庫 • .git 是一個隱藏目錄, 存放 Repo 所需要的資訊.
  19. 19. Getting Basics : Git Repository (Repo)
  20. 20. Git Basics : Git Repository (Repo) • Git Repo : 一個被 Git 追蹤的專案 • Repo stored the collection of files and their complete history.
  21. 21. Git Basics : Git Repository (Repo) 3 3
  22. 22. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git Repository • Commands • Git and Github • Git GUI • Git Branching
  23. 23. Git Basics : Commands • Create a empty directory. • Create git repository. $ mkdir hellogit $ cd hellogit $ git init
  24. 24. Git Basics : Commands • Create content • Show content $ touch data.txt $ echo “content” > data.txt $ echo “concat” >> data.txt $ cat data.txt
  25. 25. Git Basics : Commands • See the current status. $ git status
  26. 26. Git Basics : Commands • Add file to the staging area. $ git add data.txt $ git add .
  27. 27. Git Basics : Commands • Remove file to the staging area. $ git rm data.txt
  28. 28. Git Basics : Commands • Commit file to the local repository. $ git commit –m “Your commit msg”
  29. 29. Git Basics : Commands • Show git log for the change. $ git log
  30. 30. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git and Github • Git GUI • Git Branching
  31. 31. • Make a new repository on GitHub. Github : Git and Github
  32. 32. • Make a new repository on GitHub. Github : Git and Github “Your Repo Name”
  33. 33. • Creates a remote named “origin” pointing at your github repo. Github : Git and Github $ git remote add origin “URL” “ URL ”
  34. 34. • Push your commit. Github : Git and Github $ git push origin master
  35. 35. • Push your commit. Github : Git and Github $ git push origin master
  36. 36. • Push your commit. Github : Git and Github
  37. 37. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching
  38. 38. Git GUI • Graphical Git Client for Linux • Git-cola • Gitg • SmartGit • Giggle • Git Gui • qGit • gitk
  39. 39. Git GUI • Gitk
  40. 40. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  41. 41. Git Branching : Data Structures 紀錄檔案內容 檔案目錄 紀錄訊息
  42. 42. Git Branching : Data Structures • Single commit repository data.
  43. 43. Git Branching : Data Structures • Git object data for multiple commits.
  44. 44. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  45. 45. Git Branching: About Branching • Create a new branch. $ git branch testing “ Your branch name”
  46. 46. Git Branching: About Branching • Switch to an existing branch. $ git checkout testing “ Your branch name”
  47. 47. Git Branching: About Branching • Switch to an existing branch. $ git checkout testing “ Your branch name”
  48. 48. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  49. 49. Git Branching: Merge Branches $ git checkout –b iss53 “ Your branch name”
  50. 50. Git Branching: Merge Branches index.html $ vim index.html $ git add $ git commit –m “issue 53”
  51. 51. index.html index.html $ git checkout master $ git checkout –b hotfix $ vim index.html $ vim add $ git commit –m “hotfix”
  52. 52. index.html index.html $ git checkout master $ git merge hotfix $ git branch –d hotfix
  53. 53. $ git checkout master $ git merge iss53
  54. 54. master and iss53 : no common ancestors
  55. 55. master and iss53 : no common ancestors
  56. 56. Reference • Git Documentation • http://git-scm.com/documentation • 版本控制系統Git 精要| ihower 的Git 教室 • http://ihower.tw/git/remote.html • 寫給大家的Git 教學 • http://www.slideshare.net/littlebtc/git-5528339
  57. 57. Q & A 愚人節快樂 :)
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×