Weitere ähnliche Inhalte Ähnlich wie モデルから知るGit (20) Mehr von Masahiro Honma (20) モデルから知るGit2. • (id:hiratara)
•
• Perl
Python Java Haskell
• Git
4. hoge.git/
hoge/.git/ bare config
config refs
refs ...
...
dir hoge/ dir
.gitignore
hoge.txt
dir ...
11. •
( )
• 2
• ( root)
•
12. •
•
=
index.html
=
flower.gif index.js
13. git svn
SVN
Git
A B C D
14. git svn
git merge --squash
SVN
Git
15. git svn
• git
• git ID
→
•
→
18. =refs/heads
• ref .git/refs
• .git/refs/tags/
• .git/refs/heads/
• .git/refs/remotes/
20. ref
• 2
heads/hiratara/master
remotes/hiratara/master
• hiratara/master
• remotes/hiratara/master
27. topic
topic
1 2
master
3
29. ID
•
ID
→ID
• ID
→ ID
→ID
39. reflog
•
• git reflog show master C
master
48. 3
.git
topic
master
A B C D
D D
50. .git
topic
master
A B C D
D D’
52. .git
topic
master
A B C D
D’ D’’
56. 3
.git
topic
master
A B C D
commit -a
commit commit filename
add
D’ D’’
59. (2)
.git
topic
master
A B C D
D' D''
62. (1)
.git
topic
master
A B C D
C' C''
67. •
(origin/master )
• git fetch git push
69. git remote add
github => git@github.com:him/hoge.git
A B C D master
git remote add github git@...
~/git-repos/hoge
A B C X master
70. git fetch
github => 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
71. refspec
•
• push, fetch
(fetch )
github
heads/from git fetch github from:to
heads/to ※ heads
heads/to git push github from:to
heads/from
72. fetch refspec
• git remote add
•
73. merge rebase
github => 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
74. git push
github => 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
75. push refspec
• refspec
→" push"
• push.default
nothing, matching, tracking, current
• remote.<name>.push
(F/W fetch )
76. fetch pull push(1)
github => git@github.com:him/hoge.git
heads/master
heads/another
git fetch github
~/git-repos/hoge remote.<name>.fetch
remotes/github/master
remotes/github/another
heads/master
heads/local-branch
heads/another
77. fetch pull push(2)
github => git@github.com:him/hoge.git
heads/master
heads/another branch.<name>.remote
~/git-repos/hoge git pull = fetch + merge
remotes/github/master
remotes/github/another branch.<name>.merge
heads/master
heads/local-branch
heads/another
78. fetch pull push(3)
github => git@github.com:him/hoge.git
heads/master
heads/another
git push github
~/git-repos/hoge push.default=matching
remotes/github/master
remotes/github/another
heads/master
heads/local-branch
heads/another
83. git remote -f add
origin/topic1 master
origin/master
topic1 master
hanako/topic1
origin/topic1 topic2
hanako/master
origin/master
topic1 master
84. git push hanako topic2
origin/topic1 master
origin/master
topic1 master
hanako/topic1
origin/topic1 topic2 hanako/topic2
topic2
hanako/master
origin/master
topic1 master
85. tarou pull-req
origin/topic1 master
origin/master
topic1 master
pull request
hanako/topic1
origin/topic1 topic2 hanako/topic2
topic2
hanako/master
origin/master
topic1 master
86. taro remote add
hanako/topic1 master hanako/topic2
origin/topic1
hanako/master
origin/master
topic1 master
hanako/topic1
origin/topic1 topic2 hanako/topic2
topic2
hanako/master
origin/master
topic1 master
87. merge hanako/topic2
hanako/topic1 master hanako/topic2
origin/topic1
hanako/master
origin/master
topic1 master
hanako/topic1
origin/topic1 topic2 hanako/topic2
topic2
hanako/master
origin/master
topic1 master
88. git push origin master
hanako/topic1 master hanako/topic2
origin/topic1
hanako/master origin/master master
origin/master
topic1
hanako/topic1
origin/topic1 topic2 hanako/topic2
topic2
hanako/master
origin/master
topic1 master