モデルから知るGit

  • 10,271 views
Uploaded on

Git初心者向けの解説です。図が中心。

Git初心者向けの解説です。図が中心。

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
10,271
On Slideshare
0
From Embeds
0
Number of Embeds
9

Actions

Shares
Downloads
55
Comments
0
Likes
23

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Git2011 3 9 (id:hiratara)
  • 2. • (id:hiratara)•• Perl Python Java Haskell• Git
  • 3. • Git•••
  • 4. hoge.git/hoge/.git/ bare config config refs refs ... ... dir hoge/ dir .gitignore hoge.txt dir ...
  • 5. Git
  • 6. Git•• Linus•
  • 7. Git
  • 8. .git/• .git/config git config• .git/refs/...
  • 9. Author: hirataraDate: 2/25 13:43:42typoindex.htmlimages/flower.gifcss/index.cssjs/index.js
  • 10. • ( )• 2• ( root)•
  • 11. •• = index.html = flower.gif index.js
  • 12. git svnSVNGit A B C D
  • 13. git svn git merge --squashSVNGit
  • 14. git svn• git • git ID → • →
  • 15. git•• →• ID
  • 16. remotes/origin/mastertags/0.9973 heads/topic heads/master
  • 17. =refs/heads• ref .git/refs • .git/refs/tags/ • .git/refs/heads/ • .git/refs/remotes/
  • 18. ref• .git/• .git/refs/• .git/refs/tags/• .git/refs/heads/• .git/refs/remotes/
  • 19. ref• 2 heads/hiratara/master remotes/hiratara/master• hiratara/master• remotes/hiratara/master
  • 20. topic master
  • 21. git commit(1)topic 1 master
  • 22. git commit(2) topic1 2 master
  • 23. topic1 2 master
  • 24. git merge topic1 2 master
  • 25. git commit(3) topic1 2 master 3
  • 26. topic topic1 2 master 3
  • 27. git commit(4) topic1 2 4 master 3
  • 28. ID• ID →ID• ID → ID →ID
  • 29. ID SHA1 • • ID
  • 30. • ID →ID →• Git
  • 31. topicB C master A
  • 32. git rebaseB C B C master topic A B’ C’
  • 33. topicB C master A
  • 34. git cherry-pick B topic B C master A B
  • 35. git cherry-pick C topic B C master A B C
  • 36. masterA B C
  • 37. rebase -i HEAD~3 master A B C A B C A B C
  • 38. reflog • • git reflog show master C master
  • 39. masterA B CA B C
  • 40. git reset CA B C masterA B C
  • 41. masterA B C
  • 42. git revert A masterA B C -A
  • 43. topic master
  • 44. committopic master
  • 45. git merge master topic master
  • 46. 3.git topic master A B C D D D
  • 47. • •• staged cached
  • 48. .git topic master A B C D D D’
  • 49. git add.git topic master A B C D add D’ D’
  • 50. .git topic master A B C D D’ D’’
  • 51. git add.git topic master A B C D add D’’ D’’
  • 52. git commit.git topic master A B C D D’’ commit D’’ D’’
  • 53. • D’ →•
  • 54. 3.git topic master A B C D commit -a commit commit filename add D’ D’’
  • 55. (1).git topic master A B C D D D
  • 56. git checkout master.git topic master A B C D C C
  • 57. (2).git topic master A B C D D D
  • 58. git checkout master ..git topic master A B C D C C
  • 59. git checkout ..git topic master A B C D D D
  • 60. (1).git topic master A B C D C C
  • 61. git reset --soft topic.git topic master A B C D C C
  • 62. git reset topic.git topic master A B C D D C
  • 63. git reset --hard topic.git topic master A B C D D D
  • 64. • (origin/master )• git fetch git push
  • 65. git@github.com:him/hoge.git A B C D master~/git-repos/hoge A B C X master
  • 66. git remote addgithub => git@github.com:him/hoge.git A B C D master git remote add github git@...~/git-repos/hoge A B C X master
  • 67. git fetchgithub => git@github.com:him/hoge.git A B C D master git fetch github~/git-repos/hoge ( git remote update) D github/master A B C X master
  • 68. refspec•• push, fetch (fetch )githubheads/from git fetch github from:toheads/to ※ headsheads/to git push github from:toheads/from
  • 69. fetch refspec• git remote add•
  • 70. merge rebasegithub => git@github.com:him/hoge.git A B C D master~/git-repos/hoge git rebase github/master D github/master A B C X X` master
  • 71. git pushgithub => git@github.com:him/hoge.git A B C D X` master~/git-repos/hoge git push github D github/master A B C X X` master
  • 72. push refspec• refspec →" push"• push.default nothing, matching, tracking, current• remote.<name>.push (F/W fetch )
  • 73. fetch pull push(1)github => git@github.com:him/hoge.githeads/masterheads/another git fetch github~/git-repos/hoge remote.<name>.fetchremotes/github/masterremotes/github/anotherheads/masterheads/local-branchheads/another
  • 74. fetch pull push(2)github => git@github.com:him/hoge.githeads/masterheads/another branch.<name>.remote~/git-repos/hoge git pull = fetch + mergeremotes/github/masterremotes/github/another branch.<name>.mergeheads/masterheads/local-branchheads/another
  • 75. fetch pull push(3)github => git@github.com:him/hoge.githeads/masterheads/another git push github~/git-repos/hoge push.default=matchingremotes/github/masterremotes/github/anotherheads/masterheads/local-branchheads/another
  • 76. githuborigin/topic1 masterorigin/master topic1 master
  • 77. hanako taro cloneorigin/topic1 masterorigin/master topic1 masterorigin/topic1origin/master
  • 78. hanako topic2origin/topic1 masterorigin/master topic1 masterorigin/topic1 topic2origin/master
  • 79. hanako taro forkorigin/topic1 masterorigin/master topic1 masterorigin/topic1 topic2origin/master topic1 master
  • 80. git remote -f addorigin/topic1 master origin/master topic1 masterhanako/topic1 origin/topic1 topic2hanako/master origin/master topic1 master
  • 81. git push hanako topic2origin/topic1 master origin/master topic1 masterhanako/topic1 origin/topic1 topic2 hanako/topic2 topic2hanako/master origin/master topic1 master
  • 82. tarou pull-reqorigin/topic1 master origin/master topic1 master pull requesthanako/topic1 origin/topic1 topic2 hanako/topic2 topic2hanako/master origin/master topic1 master
  • 83. taro remote addhanako/topic1 master hanako/topic2 origin/topic1hanako/master origin/master topic1 masterhanako/topic1 origin/topic1 topic2 hanako/topic2 topic2hanako/master origin/master topic1 master
  • 84. merge hanako/topic2hanako/topic1 master hanako/topic2 origin/topic1hanako/master origin/master topic1 masterhanako/topic1 origin/topic1 topic2 hanako/topic2 topic2hanako/master origin/master topic1 master
  • 85. git push origin masterhanako/topic1 master hanako/topic2 origin/topic1hanako/master origin/master master origin/master topic1hanako/topic1 origin/topic1 topic2 hanako/topic2 topic2hanako/master origin/master topic1 master
  • 86. github
  • 87. • git svn →• git