-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbranch.tex
175 lines (119 loc) · 3.43 KB
/
branch.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
% This is part of the ``Git First Step''.
% Copyright 2014, 2020 Yoshida Shin.
% See the file slide.tex for copying conditions.
\begin{frame}<1-4>[t]{branch (一覧、作成)}{branch を使用する}
branch の一覧表示、作成
\vspace{4ex}
\onslide*<1>{
現在の branch を確認
\vspace{2ex}
\$ git branch
\code{* master}
}
\onslide*<2>{
新 branch の作成
\vspace{2ex}
\$ git branch develop
}
\onslide*<3>{
現在の branch を確認
\vspace{2ex}
\$ git branch
\code{
* master
\onslide<99>{* }develop
}
}
\onslide*<4>{
repository の更新を行ってみる
\vspace{2ex}
\$ git add c
\$ git commit -m 'Add c.'
}
\end{frame}
\begin{frame}[t]{中で起きている事}{branch を使用する}
\begin{columns}
\begin{narrowcolumn}
\begin{block}{workspace}
c d
\end{block}
\begin{block}{cached (index)}
\onslide<8->{c} d
\end{block}
\end{narrowcolumn}
\begin{halfcolumn}
\begin{repository}{repository}
\onslide<12->{
\node (c3) [commit, rectangle split, rectangle split parts=2] at (0em, 14ex) {
\commitmessage{Add c.}
\nodepart{second}{\onslide<12->{master{\HEAD}}}
};
}
\onslide*<10-11>{
\node (c3) [commit, rectangle split, rectangle split parts=1] at (0em, 14ex) {
\commitmessage{Add c.}
};
}
\node (c2) [commit, rectangle split, rectangle split parts=2] at (0em, 6ex) {
\commitmessage{Rename a to d and delete b.}
\nodepart{second}{\onslide*<-11>{master{\HEAD}} \onslide*<5->{develop}}
};
\node (c1) [commit] at (0em, 0ex) {
\commitmessage{Add a and b.}
};
\onslide<10->{\draw (c2) -- (c3);}
\draw (c1) -- (c2);
\end{repository}
\end{halfcolumn}
\end{columns}
\vspace{2ex}
\onslide*<2-3>{
\$ git branch
\vspace{2ex}
\onslide*<2>{現在の branch 一覧を表示}
\onslide*<3>{
\code{* master}
* は HEAD が向いている branch の印
}
}
\onslide*<4-5>{
\$ git branch develop
\vspace{2ex}
HEAD と同じ commit を指す branch を作成
}
\onslide*<6>{
\$ git branch
\vspace{2ex}
\code{
* master
\onslide<99>{* }develop
}
}
\onslide*<7-8>{
\$ git add c
\vspace{2ex}
c を cached へコピー
}
\onslide*<9-13>{
\$ git commit -m 'Add c.'
\vspace{2ex}
\onslide*<9-10>{cached を取り込み、message を添えて、現在の HEAD を親とする commit を作成}
\onslide*<11-12>{
HEAD が branch を指している時は
その branch の向き先を新しい commit へ変更
}
\onslide*<13>{HEAD が指しているのは master だけなので、develop は放置}
}
\end{frame}
\begin{frame}[t]{git branch コマンド補足 (一覧、作成)}{branch を使用する}
\begin{itemize}
\item git branch [-a]
で現在の branch 一覧を表示
-a オプションをつけると、remote branch\footnote{後述} も表示する
\vspace{2ex}
\item git branch \textit{branch-name} [\textit{start-point}]
で start-point をさす branch を作成
start-point は branch, HEAD, ハッシュ値\footnote{後述}, タグ\footnote{後述} 等で指定
start-point のデフォルト値は HEAD
\end{itemize}
\end{frame}