@@ -21,9 +21,18 @@ zero parents for the initial commit, one parent for a normal commit,
2121and multiple parents for a commit that results from a merge of two or more
2222branches.
2323
24- .. mermaid:: /../assets/mermaid/git/commits.mmd
25- :align: center
26- :caption: Commits tree
24+ .. only:: html
25+
26+ .. mermaid:: /../assets/mermaid/git/commits.mmd
27+ :align: center
28+ :caption: Commits tree
29+
30+ .. only:: latex
31+
32+ .. figure:: /../assets/mermaid/git/commits.mmd.png
33+ :align: center
34+
35+ Commits tree
2736
2837A branch in Git is simply a lightweight movable pointer to one of these
2938commits. The default branch name in Git is master. As you start making commits,
@@ -156,9 +165,18 @@ last commit on ``master`` branch, Git simply moves the pointer forward.
156165Changes from ``feature/issue53`` are now in the snapshot of the commit pointed
157166to by the ``master`` branch.
158167
159- .. mermaid:: /../assets/mermaid/git/merge-1.mmd
160- :align: center
161- :caption: Fast-forward merge
168+ .. only:: html
169+
170+ .. mermaid:: /../assets/mermaid/git/merge-1.mmd
171+ :align: center
172+ :caption: Fast-forward merge
173+
174+ .. only:: latex
175+
176+ .. figure:: /../assets/mermaid/git/merge-1.mmd.png
177+ :align: center
178+
179+ Fast-forward merge
162180
163181Now, lets assume another developer started working on ``feature/issue54`` at
164182the same time. And there are few commits on this feature branch. Suppose,
@@ -188,9 +206,18 @@ that results from this three-way merge and automatically creates a new commit
188206that points to it. This is referred to as a *merge commit*, and is a special in
189207that it has more than one parent.
190208
191- .. mermaid:: /../assets/mermaid/git/merge-2.mmd
192- :align: center
193- :caption: Merge commit
209+ .. only:: html
210+
211+ .. mermaid:: /../assets/mermaid/git/merge-2.mmd
212+ :align: center
213+ :caption: Merge commit
214+
215+ .. only:: latex
216+
217+ .. figure:: /../assets/mermaid/git/merge-2.mmd.png
218+ :align: center
219+
220+ Merge commit
194221
195222Merge conflicts
196223---------------
@@ -271,9 +298,18 @@ the ``merge`` and the ``rebase``.
271298Earlier, there was an example of diverged work and commits made on two
272299different branches.
273300
274- .. mermaid:: /../assets/mermaid/git/rebase-1.mmd
275- :align: center
276- :caption: Before rebase
301+ .. only:: html
302+
303+ .. mermaid:: /../assets/mermaid/git/rebase-1.mmd
304+ :align: center
305+ :caption: Before rebase
306+
307+ .. only:: latex
308+
309+ .. figure:: /../assets/mermaid/git/merge-2.mmd.png
310+ :align: center
311+
312+ Merge commit
277313
278314The easiest way to integrate the branches, as we've already covered, is
279315the ``merge`` command. It performs a three-way merge between the two latest
@@ -298,9 +334,18 @@ those diffs to temporary files, resetting the current branch to the same
298334commit as the branch you are rebasing onto, and finally applying each change
299335in turn.
300336
301- .. mermaid:: /../assets/mermaid/git/rebase-2.mmd
302- :align: center
303- :caption: After rebase
337+ .. only:: html
338+
339+ .. mermaid:: /../assets/mermaid/git/rebase-2.mmd
340+ :align: center
341+ :caption: After rebase
342+
343+ .. only:: latex
344+
345+ .. figure:: /../assets/mermaid/git/rebase-2.mmd.png
346+ :align: center
347+
348+ After rebase
304349
305350.. note::
306351 Other maintainers prefer to rebase (or cherry-pick) contributed work on
@@ -318,9 +363,18 @@ of commits on a topic branch and you want to integrate only one of them,
318363or if you only have one commit on a topic branch and you'd prefer to
319364cherry-pick it rather than run rebase.
320365
321- .. mermaid:: /../assets/mermaid/git/cherry-pick.mmd
322- :align: center
323- :caption: Cherry-pick a commit
366+ .. only:: html
367+
368+ .. mermaid:: /../assets/mermaid/git/cherry-pick.mmd
369+ :align: center
370+ :caption: Cherry-pick a commit
371+
372+ .. only:: latex
373+
374+ .. figure:: /../assets/mermaid/git/cherry-pick.mmd.png
375+ :align: center
376+
377+ Cherry-pick a commit
324378
325379::
326380
@@ -368,6 +422,15 @@ new features and bug fixes are integrated smoothly before being released.
368422This strategy is particularly useful for projects with regular releases and
369423a team working on multiple features concurrently.
370424
371- .. mermaid:: /../assets/mermaid/git/gitflow.mmd
372- :align: center
373- :caption: GitFlow diagram
425+ .. only:: html
426+
427+ .. mermaid:: /../assets/mermaid/git/gitflow.mmd
428+ :align: center
429+ :caption: GitFlow diagram
430+
431+ .. only:: latex
432+
433+ .. figure:: /../assets/mermaid/git/gitflow.mmd.png
434+ :align: center
435+
436+ GitFlow diagram
0 commit comments